Topic Contributors
creator avatar  
mreschke
Matthew Reschke
Site Developer
Created: Jun 30th, 2008
Updated: Nov 27th, 2010
File
Download Selected (zip)
Download Selected (tar.gz)
Edit
Select All
Select None
View
Detail
Detail Preview
Icons
Preview
Show Hidden
Hide Hidden
Full Manager
Reset Defaults
Open In New Tab
Open In New Window
List Archive Contents
Download File
Open
Download Folder (as .zip)
Linux SendEmail
Post # 79 permalink Topic #79 by mreschke on 2008-06-30 22:02:15 (viewed 1,652 times)

Not to be confused with linux sendmail.

  1. apt-get install sendEmail
  1. Create a bash script "sendemail" and run chmod 755 on it.
    Code Snippet
    #!/bin/sh
    
    export smtpemailfrom=zabbix@yourdomain.com
    export zabbixemailto=$1
    export zabbixsubject=$2
    export zabbixbody=$3
    export smtpserver=yoursmtpserver.com
    export smtplogin=smtpuser
    export smtppass=smtppassword
    
    #Use this line if your SMTP server requires authentication
    /usr/bin/sendEmail -f $smtpemailfrom -t $zabbixemailto -u $zabbixsubject -m $zabbixbody -s $smtpserver:25 -xu $smtplogin -xp $smtppass
    
    #User this line if your SMTP server does NOT require authentication
    /usr/bin/sendEmail -f $smtpemailfrom -t $zabbixemailto -u $zabbixsubject -m $zabbixbody -s $smtpserver:25
    

To run the script

Code Snippet
sendemail email@domain.com 'subject here' 'message here!!, cool'

Resources[-][- -][++]