Exim configuration for outgoing emails
apt-get install exim4
Set/adjust mail name as necessary:
vi /etc/mailname
Set aliases to redirect root mail to other email address:
vi /etc/aliases
add/amend
root: postmaster@example.com
apply new aliases file
newaliases
exim seems to use the local user (app-name) www-data without a domain as original sender which some email providers (e.g. emailantidote.com) rejects as valid sender.
Update exim config to set default domain for www-data user:
vi /etc/email-addresses
add
www-data: noreply@example.com
save and restart exim
/etc/init.d/exim4 restart
Now force mail queue:
exim -qff
To check the message queue, use
ls -la /var/spool/exim4/msglog/
To send via smarthost, generate a smarthost authentication file (replace with actual username/password):
echo "*:smarthost-login:smarthost-password" > /etc/exim4/passwd.client
By default, exim does not send external emails. Use the following to set it to send using “smarthost, no local” and ensure to enter the smart host name:
dpkg-reconfigure exim4-config
To allow non-tls passwords for the smarthost, use:
echo "AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS = 1" >> /etc/exim4/exim4.conf.localmacros
To avoid 'message is too big (transport limit = 1)' error, triggered by some cron output, use:
echo "IGNORE_SMTP_LINE_LENGTH_LIMIT=1" >> /etc/exim4/exim4.conf.localmacros
Disable ipv6
sed -i s/dc_local_interfaces='127.0.0.1 ; ::1'/dc_local_interfaces='127.0.0.1'/g /etc/exim4/update-exim4.conf.conf update-exim4.conf
Restart exim using
service exim4 restart