HELO {fromdomain} MAIL FROM: {mailfrom} RCPT TO: {mailto} DATA Subject:{subject} {2x CR's} {body} . QUIT
In sendmail.mc, ass these lines
define(`SMART_HOST', `smtp.server.com')dnl ... MASQUERADE_AS(send.from.domain.com) FEATURE(masquerade_envelope)
Authentication
Generate some certificates
mkdir -p /etc/mail/ssl/ && cd /etc/mail/ssl openssl req -new -x509 -keyout cakey.pem -out cacert.pem -days 3650 openssl req -nodes -new -x509 -keyout sendmail.pem -out sendmail.pem -days 3650 chmod 600 *
Add the authentication to access (Sendmail 8.12+)
echo "AuthInfo:<smtp.server.com> \"U:root\" \"I:<username>\" \"P:<password>\" >> /etc/mail/access makemap -r hash -t hash /etc/mail/access.db < access
Change lines in /etc/mail/sendmail.mc
FEATURE(`authinfo',`hash /etc/mail/auth/auth.db')dnl define(`SMART_HOST',`<smtp.server.com')dnl define(`CERT_DIR', `/etc/mail/certs') define(`confCACERT_PATH', `CERT_DIR') define(`confCACERT', `CERT_DIR/ca-bundle.crt') define(`confCRL', `CERT_DIR/ca-bundle.crt') define(`confSERVER_CERT', `CERT_DIR/sendmail.pem') define(`confSERVER_KEY', `CERT_DIR/sendmail.pem') define(`confCLIENT_CERT', `CERT_DIR/sendmail.pem') define(`confCLIENT_KEY'’, `CERT_DIR/sendmail.pem') define(`confAUTH_MECHANISMS’, `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN’)
And regen the conf
m4 sendmail.mc > sendmail.cf
This will overwrite the smart_host parameter. This allows mail with different domains to be sent via different smtp servers
root@aucsdcsrv0111 /u3/faxlink> cat /etc/mail/mailertable pulsemining.com.au smtp:smtp.auc.xstrata.int xstratacoal.com.au smtp:smtp.auc.xstrata.int