You can use gmail or any other SMTP server as a smart host to send all messages from your Linux / UNIX desktop systems. You need to use a simple program called ssmtp. It accepts a mail stream on standard input with recipients specified on the command line and synchronously forwards the message to the mail transfer agent of a mailhub for the mailhub MTA to process.
# yum install ssmtp
# vi /etc/ssmtp/ssmtp.conf
Modify the following setting to setup SMTP mail server. Here, we have configured Google SMTP server to send mail.
AuthUserfirstname.lastname@example.org AuthPass=*********** FromLineOverride=YES mailhub=smtp.gmail.com:587 UseSTARTTLS=YES
Note: Before using this method to send mail, you need to disable sendmail.
# service sendmail stop
# chkconfig sendmail off
Now, you can use mail / mailx command to send email messages. You can also write a shell script to backup your files and email to somewhere else (see below). You can test settings using following syntax:
echo “This is a test” | mail -s “Test” email@example.com
Limittation of sSmtp:
sSMTP works well for desktop systems, but it is not a replacement for Sendmail / Postfix / Exim / Qmail for email server environment. This software is perfect for a single user system.
- 33For Send mail Tutorial Click Here Need to be installed sendmail ( yum install sendmail) and mailx (yum install mailx) Create a shell script in linux. vi diskalert.sh #!/bin/sh support="firstname.lastname@example.org" # set alert level 90% is default ALERT=90 df -HP | grep -vE '^Filesystem|tmpfs|cdrom' | while read partition size…