Mail for domain.com loops back on myself

Hi. I had created a virtual server some time back which didn’t handle the mail for domain.com. Now I decided that this virtualserver should handle the mails as well. So I created an email Id: contact@domain.com (should’ve created this after configuration changes). Then

  • I created DNS entries for MX records
  • Edited the virtual server and enabled Mail for Domain
  • Added SSL certificate for mail.domain.com via Letsencrypt

I’m able to receive mails now but if I try to send one, I get

Failed to send mail:  SMTP command rcpt to: <myemail@gmail.com> failed : 450 4.1.7 <contact@domain.com>: Sender address rejected: unverified address: mail for domain.com loops back to myself

I tried System Settings > Re-check Configuration and Limits and Validations > Validate Virtual Servers. Everything is ok.

Next I created another email address info@domain.com and on this one, I’m able to both send and receive. So I deleted the contact id and created it again, but this id is still giving the same error.

Any ideas?

Don’t name your server the same name as a domain you will be hosting mail for.

The FQDN of the server is different if that’s what you mean.

Joe was saying that if you have a virtual server associated with domain.tld then do not create another virtual server associated with mail.domain.tld or any of the reserved subdomains that Virtualmin uses.

No no I didn’t do that. There’s just one virtualserver for domain.com

If the hostname doesn’t match the name in the MX record for your domain, than you’ve told Postfix that it is the domain in question some other way, maybe mydomain or myorigin or some other option that probably shouldn’t be changed from its default.

This error means Postfix is confused about where the mail is supposed to go. It could be a DNS problem (your MX record is wrong, or your A record for the name the MX record points to is wrong), or…I dunno. The most common cause is that the hostname is also the name of a domain that’s setup as a virtual domain (or DNS tells postfix that it is).

Apologies but you’re talking very high level here. I’m not sure I follow. The domain is questfame.com if that helps you spot any problems with it. I have 1 mx record: mail.questfame.com

Can you give me something specific to check? Where would be the settings that are likely to fix the mismatch that you’re talking about?

Does /etc/postfix/virtual have appropriate entries for this user and domain?

I’m not sure whats appropriate. Here are the entries for this domain

questfame.com	questfame.com
hostmaster@questfame.com	egcworld@egcworld.in
webmaster@questfame.com	egcworld@egcworld.in
postmaster@questfame.com	egcworld@egcworld.in
abuse@questfame.com	egcworld@egcworld.in
info@questfame.com	info-questfame.com
contact@questfame.com	contact-questfame.com

Note that questfame.com is a sub server of egcworld.in if that’s relevant

That looks fine. And, a user named contact-questfame.com (and contact@questfame with same UID) exists?

Might be something wrong in main.cf. So, post postconf and we can check that out.

And, just to be sure, go ahead and check hostname -f and hostname, to be sure the server is named what you think it is.

Actually it has started working now. urghh.

Could be DNS issues.

Thanks for your help Joe

It’s always DNS.

1 Like

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.