How to get Exim to accept mail for subdomains

eximsubdomainwildcard-subdomain

I'm trying to use subdomains with Exim, but If I send a test message to any address other fqdn than my basic domain name it gets bounced with a relay error. I can send and login to both Dovecot and Exim with an address with, for example, testing@mysub.mydomain.com, but can only send mail out from that address. Incoming mail works only on the primary domain.

Unfortunately, I chose the Debian muli-file configuration option when I set up my email servers a year ago, so theres lots of config files. Let me know if there is a particular one(s) to post that would be relevant.

I have a workaround, but it ditches the subdomain entirely from the address in the sending and requires only 'local' usernames, not allowing usernames with the full email address.

How can I get Exim to allow all subdomains? It's letting me login with full email address, why not recognizing that address exists?

I'm using PAM user auth with full email addresses for email-enabled usernames. I'm thinking maybe I have a misconfig somewhere in the routing that's appending the domain on top of the email address, since usually PAM uses plain usernames, not full email addresses. It's not in the auth though. It's gotta be in the routing. On the other hand, maybe it has nothing to do with that.

Any ideas would be most welcome, as my searches have turned up everything except how to get Exim to accept mail for subdomains.

Best Answer

If you are editin the cofiguration directly, add a wildcard to your MAIN_LOCAL_DOMAINS macro in your configuration or template.

MAIN_LOCAL_DOMAINS=@:localhost:example.com : *.example.com 

This will set the local_domains used to accept email.

domainlist local_domains = MAIN_LOCAL_DOMAINS

If you are using Debian based configuration specify your domains as other domains in 'update-exim4.conf.conf' like this:

dc_other_hostnames='example.com : *.example.com'

If you want to verify for actual local subdomains, you and use a DNS lookup instead of a wildcard. See the Exim Specification. The relevant sections are "File and database lookups" and "Domain, host, address, and local part lists"

For lookups on full username including domain, you are outside the normal user lookups. Check the documentation on virtual domains for that kind of lookup. See the Specification section on "Some common configuration settings". There is also an excellent FAQ available.

Related Topic