Quantcast
Channel: How to send mail from the command line? - Ask Ubuntu
Viewing all articles
Browse latest Browse all 18

Answer by Sid for How to send mail from the command line?

$
0
0
  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.)
    
  6. Press Ctrl + D to send.


You can also put the text in file and send it as follows:

ssmtp recipient_name@gmail.com < filename.txt

Viewing all articles
Browse latest Browse all 18

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>