While working on a clients computer yesterday I needed to send some of the logs from the computer to myself so I could analyze later on my computer. At first I had to install the Exim MTA which I will write an article on in the near future but once installed mail was still not being received. You won’t actually receive an error from the CLI when attempting to use the mail command from the CLI however after investigating the Exim logs located in /var/log/exim/ the below error was observed and resolving the issue was completed using the steps below.
Ubuntu Exim MTA Error When Attempting To Send Email:
2010-09-10 00:21:41 1Ow5yf-0001Fh-2k <= root@user-desktop U=root P=local S=917 2010-09-10 00:21:41 1Ow5yf-0001Fh-2k ** firstname.lastname@example.org R=nonlocal: Mailing to remote domains not supported 2010-09-10 00:21:41 1Ow5yf-0001Fj-4q <= <> R=1Ow5yf-0001Fh-2k U=Debian-exim P=local S=1730 2010-09-10 00:21:41 1Ow5yf-0001Fh-2k Completed
As you can see above the error states that mailing to remote domains is not supported. This can be resolved easily using the below steps.
Configure Exim MTA To Send Mail To Remote Domains On Ubuntu Linux:
- Launch Mail Server Configuration: First you need to launch the Exim Mail Server Configuration in a Ubuntu terminal window using the syntax below.
root@user-desktop:/home/user# sudo dpkg-reconfigure exim4-config
This will launch the below configuration window.
- Modify Mail Server Type: From the Mail Server Configuration Window shown above use the arrow keys on your keyboard to move the red bar from “local delivery only; not on a network” to “Internet site; mail is sent and received directly using SMTP” as shown in the below example image.
- Save Mail Server Settings: After selecting the top selection above click the tab key on your keyboard followed by enter to move on to the next screen. If you are using this as a temporary method to send email then keep all of the other settings the same but if you are planning to use the server for incoming and outgoing mail you should research Exim so you can configure it securely.
- Verify Server Restart: After the last graphical modification screen you will be directed back to the terminal window prompt after viewing Exim restart so the new changes will be operational as shown below.
root@user-desktop:/home/user# sudo dpkg-reconfigure exim4-config * Stopping MTA for restart [ OK ] * Restarting MTA [ OK ] root@user-desktop:/home/user#
- Verify Sending Email: Now attempt to send email again using whatever command you initially used that caused the error. After attempting to send the email look into the exim logs again to see if the email was successfully sent as shown below.
2010-09-16 00:27:24 1Ow64C-0001mr-Vc <= root@user-desktop U=root P=local S=917 2010-09-16 00:27:25 1Ow64C-0001mr-Vc => email@example.com R=dnslookup T=remote_smtp H=aspmx.l.google.com [22.214.171.124] 2010-09-16 00:27:25 1Ow64C-0001mr-Vc Completed
You should now successfully be sending email via Exim on your Ubuntu Linux server.