Configure SSMTP on Linux – How to send mail from linux system with Gmail (as smarthost)

SSMTP is a simple MTA(Message Transfer Agent) to send off mail from a Linux system to a mailhub. For a mailhub will use a Gmail account. SSMTP can send emails by itself or you can install mutt (it’s another simple MTA).
Always it’s a good idea to configure your server to notify you with some cronjobs for errors instead of not doing it at all and just checking logs by yourself :P

Installing sSMTP


1. Open a terminal and connect with ssh or just type (for local installation)

Configuring sSMTP


Once you’re done give …

…and change only these fields inside ssmtp.conf

and at the end of the file add these (one per line)

That’s it!

Sending emails from sSMTP


Type in terminal

and then type (notice lines and the blank line after subject)

then press Ctrl D and sSMTP will send your email before closing.

Send predefined emails from .txt files


Write your message to a txt file  by keeping the standard format from above and type …

Tips:


  • Overall i suggest to install sSMTP and send your emails with mutt
  • schedule some cronjobs
  • install and configure fail2ban (if you want to add some basic security to your server)

thnx, Specktator.

2 thoughts on “Configure SSMTP on Linux – How to send mail from linux system with Gmail (as smarthost)

Comment: