QMail do not delivery to remote mailboxes for the own domain

emailg-suite

Sorry for the title, I don't know how to sum up this situation.

I have a web server at mydomain.com, running qmail for website related mail delivery (i.e. newsletter, sign up confirmation, etc). qmail here is used only to send mails, because I have a fully working Google App Gmail associated with mydomain.com for normal email receiving.

qmail runs fine when sending email to remote addresses, for example to address@example.com, but fails when sending to address@mydomain.com. I think it's because the server thinks that he have to manage mailboxes for mydomain.com locally, instead of redirect them to Gmail. Here is the /var/log/qmail/current for two email: the first one is sent without problems to example.com, second one fails because it's for mydomain.com:

2012-11-15 15:04:11.551933500 new msg 262580
2012-11-15 15:04:11.551936500 info msg 262580: bytes 5604 from <anonymous@mydomain.com> qp 5185 uid 33
2012-11-15 15:04:11.575910500 starting delivery 316: msg 262580 to remote alice@example.com
2012-11-15 15:04:11.575912500 status: local 0/10 remote 1/20
2012-11-15 15:04:12.189828500 delivery 316: success: 74.125.136.27_accepted_message./Remote_host_said:_250_2.0.0_OK_1352991894_j49si13055539eep.9/
2012-11-15 15:04:12.189830500 status: local 0/10 remote 0/20
2012-11-15 15:04:12.189831500 end msg 262580

2012-11-15 16:49:20.270332500 new msg 262580
2012-11-15 16:49:20.270336500 info msg 262580: bytes 2192 from <anonymous@mydomain.com> qp 5479 uid 33
2012-11-15 16:49:20.315125500 starting delivery 323: msg 262580 to local bob@mydomain.com
2012-11-15 16:49:20.315128500 status: local 1/10 remote 0/20
2012-11-15 16:49:20.320855500 delivery 323: failure: Sorry,_no_mailbox_here_by_that_name._(#5.1.1)/
2012-11-15 16:49:20.320858500 status: local 0/10 remote 0/20
2012-11-15 16:49:20.372911500 bounce msg 262580 qp 5484
2012-11-15 16:49:20.372914500 end msg 262580

As you can see, it says:

Sorry,_no_mailbox_here_by_that_name

I can't say he's wrong 🙂

How to solve this? How to let Google App Gmail manage incoming email for mydomain.com for messages sent by mydomain.com qmail server?

Best Answer

Your really need to tell qmail that even though you have set it up to be the mail server for mydomain.com it should actually route all emails intented for this domain to a different mail server

You do this by adding smtproutes file in the /var/qmail/control directory with an entry of the form

mydonaim.com:other-mailserver.mydomain.com

Also make sure that /var/qmail/control/virtualdomains doesn't have an entry for that mydonaim.com


Another way to do it is to make sure that mydomain.com is in the /var/qmail/control/rcpthosts file but NOT in the /var/qmail/control/locals file. That will require that your MX records in DNS are setup in a way that are only pointing to Google and not the machine we are talking about.

Personally I would recomment the first option since it is cleaner to implement and does not require the use of DNS. Also that way you can use this machine as a backup MX server incase Google goes down (highly unlikely!)

Related Topic