Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

I have a web server at, 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 for normal email receiving.

qmail runs fine when sending email to remote addresses, for example to, but fails when sending to I think it's because the server thinks that he have to manage mailboxes for 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, second one fails because it's for

2012-11-15 15:04:11.551933500 new msg 262580
2012-11-15 15:04:11.551936500 info msg 262580: bytes 5604 from <> qp 5185 uid 33
2012-11-15 15:04:11.575910500 starting delivery 316: msg 262580 to remote
2012-11-15 15:04:11.575912500 status: local 0/10 remote 1/20
2012-11-15 15:04:12.189828500 delivery 316: success:
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 <> qp 5479 uid 33
2012-11-15 16:49:20.315125500 starting delivery 323: msg 262580 to local
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:


I can't say he's wrong :)

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

share|improve this question
up vote 3 down vote accepted

Your really need to tell qmail that even though you have set it up to be the mail server for 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

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

Another way to do it is to make sure that 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!)

share|improve this answer
Seems I've solved by removing from /etc/qmail/locals only (on my Debian machine, configuration files are there). Thank you very much. The MX record of my DNS were already correctly pointing to Gmail (and they have to!), so I preferred to do this way, with minimum qmail configuration edits. – lorenzo-s Nov 16 '12 at 11:05
This guy knows what he is doing. – Sammitch Nov 16 '12 at 16:29

I know nothing about how qmail works, but in general an email server that is authoritative for a domain will not forward email destined for that domain to another email server... unless the email server can be configured to share that SMTP address space.

share|improve this answer

Oh sweet jesus, someone is still using qmail? You poor soul. First and foremost, literally anything else is better than qmail.

Second, you either need to:

  1. Change your control files so that qmail no longer thinks is local.
    • I don't recall the filenames, if you post a file listing of /var/qmail/control it might refresh my memory.
  2. Configure a forward for every account in that domain to fire the email out for remote delivery.
    • You will have to send the email out via some alias domain, since qmail will always look at its local domains for delivery first, and ignore anything else if it finds a match.

Third, you'll probably have better luck posting your question to the qmail mailing list where all the grey-neckbeards who still use qmail gather. This is probably the best option since I'm having a hard time thinking of a way to make remote delivery and your mailing lists work at the same time.

share|improve this answer
What should I use instead of qmail?!? – lorenzo-s Nov 16 '12 at 11:07
I moved from qmail to Postfix and was super happy. There is also Exim and Sendmail. Sendmail is supposed to be the best MTA on the planet, but its config files literally have their own config files. But if you're only using qmail for ezmlm you might want to base you decision on that functionality. – Sammitch Nov 16 '12 at 16:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.