Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

How can I stop q-mail from handling my domain specific emails?

For example, I have a blog installed on my server and it uses PHP to make use of the mail() function to send out emails.

mail('', 'subject', 'message');

But when it sends email with it doesn't leave the server to check what the MX records are, it just sends it locally because that address exists in its records some how.

I ask because I have started making use of GMail as my mail service provider and I need emails to arrive there rather than just stay in the server.

I hope I have made this clear as I am having trouble trying to find terms that I can use to serach via Google!

Thanks all

share|improve this question

migrated from Jan 24 '11 at 14:23

This question came from our site for professional and enthusiast programmers.

Why is this tagged "php"? – Linus Kleen Jan 20 '11 at 22:53
I am making use of the PHP mail function. – Abs Jan 20 '11 at 22:55
@Abs I read that. But it's tagged just because you mentioned it. The question's not tagged "google" or "mail" either... – Linus Kleen Jan 20 '11 at 22:57
I can see where you are coming from, I have changed to google apps now. – Abs Jan 20 '11 at 23:01
up vote 5 down vote accepted

Qmail keeps it's configurations files in /var/qmail/control:

grep YOUR_DOMAIN /var/qmail/control/*

Remove your domain from the following files:

/var/qmail/control/rcpthosts /var/qmail/control/locals

share|improve this answer
I think you actually want to leave the name in rcpthosts, otherwise qmail will reject the messages outright because it's not responsible for the domain. Removing from locals tells qmail that the domain is not handled locally and it should try to deliver through smtproutes, and mx records. – David Smith Dec 23 '11 at 17:34

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.