ssmtp in ubuntu

  1. install packages
sudo apt-get install ssmtp
  1. 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
root=MyEmailAddress@gmail.com

# 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

AuthUser=MyEmailAddress@gmail.com
AuthPass=MyPassword
UseTLS=YES
UseSTARTTLS=YES

# Where will the mail seem to come from?
#rewriteDomain=
rewriteDomain=gmail.com

# The full hostname
#hostname=MyMediaServer.home
hostname=MyEmailAddress@gmail.com

# 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 recipient_email@example.com

sSMTP will then wait for you to type your message, which needs to be formatted like this:

To: recipient_email@example.com
From: myemailaddress@gmail.com
Subject: test email

Hello World!

results matching ""

    No results matching ""