sSMTP is an extremely simple, resource conserving, smtp server that will allow your desktop or server to send email. in this article we are going to use sSMTP to send outgoing email through gmail.
Unfortunately,ssmtp is not in CentOS 5 yum base repository,so we have to download and install it manually.
#rpm -Uvh ssmtp-2.61-11.8.el5.x86_64.rpm
First,backup and empty /etc/ssmtp/ssmtp.conf
#/bin/cp /etc/ssmtp/ssmtp.conf /etc/ssmtp/ssmtp.conf.OLD
add content above,save and quit.
Second,add each account that you want to be able to send mail from by editing, ‘/etc/ssmtp/revaliases’:
#echo ‘root:email@example.com:smtp.gmail.com:587’ >> /etc/ssmtp/revaliases
Please replace sender and password with your Gmail accountname and password.
Third,backup old sendmail
#/bin/mv /usr/sbin/sendmail /usr/sbin/sendmail.OLD
#ln -s /usr/sbin/ssmtp /usr/sbin/sendmail
On my system,sendmail is provided by postfix.
3、Now try sending an email
You can send an email through your favorite email client, like ‘mail’, or type:
You will then type your message, hit enter and ‘ctrl+d‘
Now that you have a simple outgoing email server setup, you can do all sorts of neat things:
Configure cron jobs to send log reports to your email address
Alert you of all kinds of system changes
Send email alerts when your computer reaches a certain temperature
Send email through PHP, Python, Ruby, and Perl