How can i send emails from my Linux box?

Linux email-from-terminal smtp ssmtp 492 times1 answer1 follower
0
Nisha Verma 15 Rep. Avishek Kumar edited question

Is there any way to send email from my Linux box to another email account? If yes, how?

♥ Spread the love ♥
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
0
Avishek Kumar 449 Rep. Avishek Kumar edited answer

There are several ways to way to send email from a Linux box, but I like sending email via gmail SMTP, configured on a Linux box.

send-only SMTP server on Linux using ssmtp

  1. Install ssmtp
  2. Open /etc/ssmtp/ssmtp.conf, for editing
  3. The content of file should look like below. Edit with your values, where required. Save and exit.

    Optional: Enable Reverse Alias

    A reverse alias gives the From: address placed on a user’s outgoing message and (optionally) the mailhub these messages will be sent through.

    Open nano -c /etc/ssmtp/revaliases , for editing

    The content of file should look like below. Edit with your values, where required. Save and exit.

    Usages of ssmtp

    Type ssmtp followed by your email address. It will wait for further input for fields like To, From, Subject and email body. Note a white line after the subject, anything after that is considered as the email body. Press ctrl+D after email body to send email.

    Alternatively, you can send email using a file as well. Create a file say email.txt with the content like below.

    and then ssmtp can be used to send email using content from file simply as

    This way you can send email after (successful/failed) execution of various automated tasks.

♥ Spread the love ♥
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
×

Login