Sendmail
Routing all outgoing mails via the outgoing smarthost:
- Ensure the IP address is added as an authorized smarthost (without authentication)
- Ensure the outgoing user has correct limits set matching your traffic volumes
- Update your configuration:
- For this you have to edit
/etc/sendmail.mc
and add the following lines at the top under the "pert(-1)dnl
" line: - Run "sendmailconfig" to use this new configuration
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`SMART_HOST', `[SMART.HOST.TLD]')dnlThis will automatically re-start sendmail
- For this you have to edit
Alternative Configuration with username authentication (un-tested)
- Change directory to where your sendmail configuration files (
sendmail.mc
andsendmail.cf
) are located, usually/etc/mail/
- Create a safe sub-directory (suggested name auth/):
- Create a file with your authentication information (suggested filename:
auth/client-info
) - Generate the authentication database and make both files readable only by root:
- Add the following lines to your
sendmail.mc
file - Generate
sendmail.cf
- Restart the sendmail daemon
- SMARTHOST should be replaced with your SMTP hostname
# mkdir auth # chmod 700 auth
AuthInfo:SMARTHOST: "U:USERNAME" "P:PASSWORD"
# cd auth # makemap hash client-info < client-info # chmod 600 client-info* # cd ..
define(`SMART_HOST',`[SMARTHOST]')dnl define(`RELAY_MAILER_ARGS', `TCP $h 587') define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
# m4 sendmail.mc > sendmail.cf
# kill -HUP `cat /var/run/sendmail.pid` (old-school) -OR- # make restart (FreeBSD) -OR- # /etc/init.d/sendmail reload (debian Linux)