ssmtp in ubuntu
- install packages
sudo apt-get install ssmtp
- configure ssmtp
sudo vim /etc/ssmtp/ssmtp.conf
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
#root=postmaster
[email protected]
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
#mailhub=mail
mailhub=smtp.gmail.com:587
[email protected]
AuthPass=MyPassword
UseTLS=YES
UseSTARTTLS=YES
# Where will the mail seem to come from?
#rewriteDomain=
rewriteDomain=gmail.com
# The full hostname
#hostname=MyMediaServer.home
[email protected]
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES
3.sending email
ssmtp [email protected]
sSMTP will then wait for you to type your message, which needs to be formatted like this:
To: [email protected]
From: [email protected]
Subject: test email
Hello World!