User Tools

Site Tools


networking:linux:ssmtp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
networking:linux:ssmtp [2019/05/10 23:11]
gcooper
networking:linux:ssmtp [2020/02/14 09:43] (current)
gcooper
Line 22: Line 22:
  
 <file> <file>
-apt install ssmtp+apt install ssmtp bsd-mailx
 </file> </file>
  
Line 39: Line 39:
 <file> <file>
 rpm -e --nodeps sendmail rpm -e --nodeps sendmail
 +</file>
 +
 +===== From Address =====
 +
 +<note important>In modern times, secure mail servers are very strict about who is authorized to send mail.  You generally must use a **valid sender e-mail 'from address'** that **matches the authentication credentials** used.</note>
 +
 +<note>Using ''FromLineOverride=YES'' will allow the sender to specify the 'from address' at the time of sending.  ''FromLineOverride=NO'' will force the 'from address' to the ''root=validsender@domain.tld'' line in ''ssmtp.conf''.</note> 
 +
 +For sending **system or 'root' mail**, you will probably have to manipulate the 'from address' to get SSMTP to send mail through a secure mail server.
 +
 +<file>
 +vi /etc/ssmtp/revaliases
 +
 +root:validsender@domain.tld
 </file> </file>
  
Line 46: Line 60:
  
 <file> <file>
-vim /etc/ssmtp/ssmtp.conf+vi /etc/ssmtp/ssmtp.conf
  
-root=adminuser@yourdomain.com +root=validsender@domain.tld      # will be the 'from address' 
-mailhub=mail.yourdomain.com:465 +mailhub=mail.domain.tld:465      # to use SSL on port 465 
-RewriteDomain=yourdomain.com+RewriteDomain=domain.tld         # instead of the host name
 #hostname=_HOSTNAME_ #hostname=_HOSTNAME_
-FromLineOverride=YES            # allows setting from address at runtime +#FromLineOverride=YES            # allows setting 'from addressat runtime 
-UseTLS=YES+UseTLS=YES                       # for SSL
 AuthUser=smtpuser AuthUser=smtpuser
 AuthPass=smtppass AuthPass=smtppass
-#Debug=YES+#Debug=YES                       # useful for troubleshooting
 </file> </file>
  
Line 62: Line 76:
  
 <file> <file>
-mailhub=mail.yourdomain.com:587+mailhub=mail.domain.tld:587
 #UseTLS=YES #UseTLS=YES
 UseSTARTTLS=YES UseSTARTTLS=YES
-#TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt   # Not needed on Ubuntu?+#TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt   # Depends on configuration - Not needed on Ubuntu 18.04
 </file> </file>
  
Line 91: Line 105:
  
 <file> <file>
-echo test | ssmtp -v tester@yourdomain.com+echo test | ssmtp -v -f "from@domain.tld" -F "Full Name" tester@yourdomain.com
 </file> </file>
  
Line 106: Line 120:
 <file> <file>
 cat << EOF >> /tmp/test.eml cat << EOF >> /tmp/test.eml
-From: MyPBX <smtp@MyPBX+From: Full Name <validsender@domain.tld
-To: Test <tester@yourdomain.com>+To: Test User <tester@somedomain.tld>
 Subject: For test only! Subject: For test only!
  
networking/linux/ssmtp.1557551469.txt.gz · Last modified: 2019/05/10 23:11 by gcooper