Distroname and release: Debian Squeeze
Use mail with SSMTP, to send through another mailserver / mailhubIt is quite simple, if you have some clients that are using the mail or mailx commandline tool, that will have to send e-mails through a mail hub, if the SMTP traffic is blocked by the ISP.
InstallationSimply install the ssmtp package.
#aptitude install ssmtpNext reconfigure the ssmtp conf file.
Then all e-mails from this system will now send through the mailhub configured here. Unless ofcourse other applications are configured to do otherwise.
/etc/ssmtp/ssmtp.conf root=postmaster Mailhub=[192.168.1.2:25] rewriteDomain=example.comThats it, everything is running.
If you have defined a username and password here, remember to chmod the file so only root, or the "superuser" have access to the file!
AuthenticationIf you do not define credentials for username and password to the remote server, remember to allow the ssmtp client to send through the mailserver.
The config can differ from setup to setup, but add the host to mynetworks, and be sure that mynetworks have permissions on the smtpd restrictions parameters.
192.168.1.10 are the IP of the client we just configured with ssmtp above.
/etc/postfix/main.cf mynetworks = 127.0.0.0/8, 192.168.1.10 smtpd_sender_restrictions = permit_mynetworks, ...other restrictions....
Changing sender addressIt is possible to change the sender address, including domain name, or actually where it looks like the e-mail is original comming from.
But it depends on your setup on your mailserver if this is possible or not!
It is quite simple, just by changing the /etc/ssmtp/revaliases file. The parameters are as follows:
So now we will define the setup for a local client user called JohnJoe.
We also have a default sender for the root user.
Remember it is possible to specify another domain than the one we have defined in the ssmtp.conf file.
/etc/ssmtp/revaliases JohnJoe:firstname.lastname@example.org:192.168.1.2:25 root:email@example.com:192.168.1.2:25 SuperUser:firstname.lastname@example.org:192.168.1.2:25