28-Aug-2011: initial release. 07-Jan-2013: adjusted for Slackware
For a small server like our virtual gateway you don’t need a full mail server package just to send mail from daily maintenance. A small simple program is good enough. Linux has several of these small MTA programs, I selected ssmtp of these. The program acts as a sendmail interface from the commandline, it only uses system resources when it must send a mail. You can build a package from a Slackbuild and install that.
Install the ssmtp package: There are only two configuration files, first edit /etc/ssmtp/ssmtp.conf:
# # /etc/ssmtp.conf -- a config file for sSMTP sendmail. # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. firstname.lastname@example.org # The place where the mail goes. The actual machine name is required # no MX records are consulted. Commonly mailhosts are named mail.domain.com # The example will fit if you are in domain.com and you mailhub is so named. mailhub=10.126.160.253 # Where will the mail seem to come from? #rewriteDomain=y # The full hostname hostname=gateway.wpl.ym
For mailhub we use 10.126.160.253, this is intended only for clients on the LAN, but the public side of our postfix mail server just doesn’t accept mail from our virtual servers. You have to make sure that the firewall accepts port 25 from the virual server to 10.126.160.253.
Then, edit /etc/ssmtp/revaliases:
# sSMTP aliases # # Format: local_account:outgoing_address:mailhub # # Example: root:email@example.com:mailhub.your.domain[:port] # where [:port] is an optional port number that defaults to 25. root:firstname.lastname@example.org
This seems to take care that the mail appears to come from “root <email@example.com>“. Make sure all programs that send mail using this small program use the full destination email address like: firstname.lastname@example.org or just root. Just root will be translated to email@example.com.
See the download page for the script and configuration files.