Howdy folks I got the following problem:
I have a domain XXXX.com which in the DNS the record MX points to an external server which handles email accounts. The website of the domain XXXX.com is on my VPS where Virtualmin is installed. In the features of the virtual server "Mail for the domain" is not set because the VPS does not have to handle anything that regards email stuff.
I have a domain YYYY.com which in the DNS the record MX points to my VPS where is stored also the website. In the features of this virtual server "Mail for the domain" is set.
When from an email address of my YYYY.com I try to send an email to an email address of XXXX.com I receive the error "mail for XXXX.com loops back to myself".
Can anyone help me with this?
Hope to hear you soon guys. My best Matteo
Take a look at your DNS if you set up everything properly for YYYY.com, then check main.cf and see if there everything looks ok, especially myhostname, mydomain and mydestination. Last but not least, what you see in mail.log? Is there more information why you have problem sending your emails and what happens when you try to send to another email or when you receive email?
- I often come to the conclusion that my brain has too many tabs open. -
Failing at desktop publishing & graphic design since 1994.
In the DNS is all set correctly.
The record MX of the domain XXXXX.com points to the external server that handles email addresses.
They have absolutely no problem send email to addresses of YYYY.com
The record MX of the domain YYYYY.com points to my VPS and I have absolutely no problem to send, with this domain, email to addresses except for this one.
This is mail.log while I was trying to send another email:
Apr 24 14:10:51 vps12345 postfix/qmgr[3160]: 906BE1AA7923: from=, size=6238, nrcpt=1 (queue active)
Apr 24 14:10:51 vps12345 postfix/smtp[27746]: 906BE1AA7923: to=, relay=none, delay=0.25, delays=0.24/0.01/0/0, dsn=5.4.6, status=bounced (mail for XXXXX.com loops back to myself)
Apr 24 14:10:51 vps12345 postfix/cleanup[27680]: C6B921AA7953: message-id=<20150424121051.C6B921AA7953@vps12345.net>
Apr 24 14:10:51 vps12345 postfix/bounce[27747]: 906BE1AA7923: sender non-delivery notification: C6B921AA7953
Apr 24 14:10:51 vps12345 postfix/qmgr[3160]: C6B921AA7953: from=<>, size=8171, nrcpt=1 (queue active)
Apr 24 14:10:51 vps12345 postfix/qmgr[3160]: 906BE1AA7923: removed
Apr 24 14:11:04 vps12345 postfix/local[27685]: C6B921AA7953: to=, orig_to=, relay=local, delay=13, delays=0/0/0/13, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME)
Apr 24 14:11:04 vps12345 postfix/qmgr[3160]: C6B921AA7953: removed
What it say when you execute "host -t mx yourdomain.tld" for both domains?
- I often come to the conclusion that my brain has too many tabs open. -
Failing at desktop publishing & graphic design since 1994.
Here's the answer:
host -t mx XXXXX.com
XXXXX.com mail is handled by 10 mail.XXXXX.com.
host -t mx YYYYY.com
YYYYY.com mail is handled by 1 mx1.ovh.net.
YYYYY.com mail is handled by 5 mx2.ovh.net.
YYYYY.com mail is handled by 100 mxb.ovh.net.
I see domain Y is using records from OVH, is that shared hosting? If you are sure you set your DNS records properly then next step would be to check main.cf in postfix and see if there everything looks ok - myhostname, mydomain and mydestination are some of the options to check, then you could limit postfix only to use IPv4 and check at the end of same file if you have some custom rules what could be the problem. I notice that when you change something in postfix over virtualmin module it will never uncomment existing lines but rather make new one at the end of the file so be sure to check what you have at the end of main.cf. Maybe i'm wrong but this problem looks like you didnt properly define "mydestination" in main.cf.
- I often come to the conclusion that my brain has too many tabs open. -
Failing at desktop publishing & graphic design since 1994.
Here is mydestination line:
mydestination = vps12345.ovh.net, localhost.ovh.net, , localhost
What should I add to this line?
To limit postfix only to IPv4 (otherwise leave "all")
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, localhost, myhost.name.tld
- I often come to the conclusion that my brain has too many tabs open. -
Failing at desktop publishing & graphic design since 1994.
I added the following lines:
mydomain = ovh.net
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, localhost, myhost.name.tld
I sent a test email but always gets back with "loops back to myself".
I think the issue happens before the email get out from my VPS (with virtualmin). I mean virtualmin notices the email address is one of the server inside itself and tries to deliver the email to it even if the mail feature is disabled without let it out to the real server destination on the DNS record.
When you say "mydomain = ovh.net" is that "ovh.net" just dummy data or the real value you put in place for that line?
- I often come to the conclusion that my brain has too many tabs open. -
Failing at desktop publishing & graphic design since 1994.
that's good question Diabolico.
The value placed inside the variable myhostname is correct. Instead I didn't know what put inside the variable mydomain so I tried with ovh.net . In my vps postfix is used for many virtual machines that handle different domain. So which server mydomain is referred to?
Your actual domain. Now if you insert same data into your DNS there could be another problem and reason why you see this error when sending emails. But if i remember right i didnt even uncomment that line, but to be sure i need to check first.
- I often come to the conclusion that my brain has too many tabs open. -
Failing at desktop publishing & graphic design since 1994.
I mean: I have a VPS on which is installed Virtualmin in my VPS I have several virtual servers which handle different domains. those domains dns settings (record A of each domain points to my vps) have the same configuration based on the email server. some MX records of those domains point to my vps and other point to OVH (on ovh you can buy mx plan to handle email).