A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: user@domain.com . Mailing to remote domains not supported.
This is a commonly noticed error in new servers or servers with newly installed mail server such as Exim4, when sending mails to external mail addresses.
In our experience providing Technical Support Services for web hosting companies, we come across many sorts of email errors, and resolve them for our customers.
Today, we’ll see what causes the error ‘mailing to remote domains not supported’ and how we fix it in Exim4 servers.
When do you see the error ‘mailing to remote domains not supported’ in Exim4 servers?
Suppose you are trying to send mails from your server to addresses outside your server, such as gmail. For a mail delivery to work fine, there has to be a working MTA.
MTA (Mail Transfer Agent) is a service that delivers mails from one server to another. Exim4 is a popular MTA that comes by default in Debian servers.
By default, Exim4 is configured to handle only mail delivery locally (ie, to domains within the same mail server) and not to domains outside the server.
This configuration is specified in the Exim configuration file ‘/etc/exim.conf’.
#ifdef DCconfig_local # configtype=local # # Stand-alone system, so generate an error for mail to a non-local domain nonlocal: debug_print = "R: nonlocal for $local_part@$domain" driver = redirect domains = !example.com qualify_domain = example.com # domains = ! +local_domains allow_fail data = :fail: Mailing to remote domains not supported no_more #.endif
If this Exim4 MTA is not installed or configured properly for delivering mails to remote servers, mail delivery to external domains fails and gives out error message:
Subject: Mail delivery failed: returning message to sender This message was created automatically by mail delivery software. Remote Domains "Mailing to remote domains not supported"
How to fix Exim4 ‘mailing to remote domains not supported’ error
The first thing to do in email errors, is to examine the mail logs and get the details of the error. The exim logs are usually available at ‘var/log/exim_mainlog’ path.
Based on the information available from the log files, we debug and fix the error with these steps.
1. Install mail server
In cases where Exim4 MTA is not installed at all, we install and configure the mail server first.
2. Mail server configuration
By default, Exim4 is configured to send mails only locally. The fix is to reconfigure it to allow mails to be sent to remote domains.
Exim configuration can be changed in two ways:
1. Editing the exim.conf file and update the parameter “dc_eximconfig_configtype=’internet'”.
2. Running the configuration wizard using ‘dpkg-reconfigure exim4-config’ command. This wizard presents the options to choose the “mail server configuration type that best meets your needs.”
The supported mail server types are:
a. internet site – This type allows the mail server to connect to a network and send and receive mails using SMTP.
b. mail sent by smarthost – This allows to forward outgoing mails to a third party mail server, called a “smarthost”. This mail server delivers mails to the destination. It also stores stores incoming mails to your server, until you download them.
c. mail sent by smarthost; no local mail – In this option, a third party mail server is used and your mail server will not handle mails for local e-mail domains.
d. local delivery only – This is the default option in Exim4 and it supports only local delivery.
From these configuration settings, we choose the option ‘internet site; mail is sent and received directly using SMTP:’, as that it the option that supports external mail delivery.
Exim is restarted after the changes and confirmed that it is working fine. Care has to be exercised while modifying Exim configuration, as even a single mistake can render the service non-functioning.
3. Test the mail delivery
Whenever a mail server configuration change is done, we send test mails and examine the mail logs to confirm that everything is working fine as intended.
After reconfiguring Exim4 to send mails to external domains, mails were delivered fine to outside addresses like gmail.com, no longer showing the error ‘mailing to remote domains not supported’.
4. Additional mail configuration
Additional points we check in mail server functionality are the hostname settings, SPF, RDNS, mail filters, etc. Due to enhanced security restrictions, many of these features are now vital for mail function.
Hostname is usually set as FQDN (Fully Qualified Domain Name) in the format ‘hostname.domainname.tld’ . Exim is also configured to accept mail only from local addresses, to avoid open relay.
Conclusion
Today we saw how our Support Engineers resolve ‘mailing to remote domains not supported’ error in Exim4 servers. In our customers’ servers, we monitor all services 24/7. This helps us to pinpoint and resolve service related errors in no time.
0 Comments