Generally, the Debian Exim 4 packages are configured through debconf. The install prompts for questions during package installation, and your initial Exim configuration is created from your answers. You can repeat the configuration process at any time by invoking:
sudo apt-get install exim4 sudo dpkg-reconfigure exim4-config
For me to use my internet email server I used these settings:
Choose "internet site; mail send and received directly using SMTP " Set to "domain.com" for "System mail name:". (look in /etc/hosts) Set to "127.0.0.1; ::1" for "IP-addresses to listen on for incoming SMTP connections" to refuse external connections. Leave as empty for "Other destinations for which mail is accepted:". Leave as empty for "Machines to relay mail for:".
The authentication information for the external SMTP service is stored in /etc/exim4/passwd.client. Run
vim /etc/exim4/passwd.client
or
mail.yourdreamhostdomain.com:user@yourdreamhostdomain.com:S0m3S3cur3P4ssW0rd
For aliases edit /etc/aliases
root: mail.domain.com
To test
echo "this is a test" | mail -s "from comandline" someone@somewhere.com [This only is you have postfix installed... ]
or
echo "This is my body" | mailx -a "From: Foo Bar <from@me.com>" -s "My sybject" "me@me.com"
Do look at what is happening in the log. Trust me, you want to know.
tail -f /var/log/exim4/mainlog
If you having issues, lets say that your emails is not going out. It could be that messages is stuck. It could also happen (like with me) that Exim has locked your IP thus no messages will go out. Clean the que! Remove all messages from the db
rm /var/spool/exim4/db/*
If you get “Mailing to remote domains not supported”: This is because Exim is by default configured to only send mail locally. You need to allow Exim to send email to other servers. However do not allow Exim to relay email as this will allow spammers to use your server to send email.
sudo dpkg-reconfigure exim4-config
To process all frozen messages in the Exim queue use this command:
mailq | grep frozen | awk '{print $3}' | xargs exim -v -M