How to set up SSMTP

  1. Install ssmtp Install ssmtp:
    sudo apt-get install ssmtp
    
  2. Edit the ssmtp config file:
    gksu gedit /etc/ssmtp/ssmtp.conf
    
  3. Append the following text:
    root=username@gmail.com
    mailhub=smtp.gmail.com:465
    rewriteDomain=gmail.com
    AuthUser=username
    AuthPass=password
    FromLineOverride=YES
    UseTLS=YES
    
  4. Run ssmtp and provide the recipient email address:
    ssmtp recepient_name@gmail.com
    
  5. Provide the message details as follows:
    To: recipient_name@gmail.com
    From: username@gmail.com
    Subject: Sent from a terminal!
    
    Your content goes here. Lorem ipsum dolor sit amet, consectetur adipisicing.
    (Notice the blank space between the subject and the body.)
    
    
    ssmtp recipient_name@gmail.com < filename.txt
    

Comments are closed.