Is it possible to set up system mail on a linux box to be sent via a different smtp server - maybe even with authentication? If so, how do I do this?If that's unclear, let give an example. If I'm at the command line and type:cat body.txt | mail -s just a test myfriend@hisdomain.comis it possible to have that be sent via an external SMTP server, like G-mail ?I'm not looking for a way to send mail from gmail from the command line but rather an option to configure the entire system to use a specific SMTP server, or possibly one account on an SMTP server (maybe overriding the from address).
Can I set up system mail to use an external SMTP server?
linux;smtp;email
I found sSMTP very simple to use.In Debian based systems:apt-get install ssmtpThen edit the configuration file in /etc/ssmtp/ssmtp.confA sample configuration to use your gmail for sending e-mails:# root is the person who gets all mail for userids < 1000root=your@email.com# Here is the gmail configuration (or change it to your private smtp server)mailhub=smtp.gmail.com:587AuthUser=your@gmail.comAuthPass=yourGmailPassUseTLS=YESUseSTARTTLS=YESNote: Make sure the mail command is present in your system. mailutils package should provide this one in Debian based systems.Update: There are people (and bug reports for different Linux distributions) reporting that sSMTP will not accept passwords with a 'space' or '#' character. If sSMTP is not working for you, this may be the case.