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

My domain's email is managed by Google Apps, so that domain users get Gmail and Calendar, etc. But I also want to be able to send applicative notifications to users outside the domain via email (e.g. "some commented on your post", and so on). However, if I try to send email through code I get blocked by Gmail after a few emails.

I send marketing email through MailChimp, to minimize the risk of appearing as spam to my users (one-click unsubscribe, etc.). But I can't send applicative message in this way.

I want to install a local MTA (my server runs Ubuntu), but I'm not sure what anti-spam measures I need to implement so that receiving MTAs don't think it's a spam server. What's stopping anyone from setting up a mail server and sending emails using my domain name? AFAIK it's the DNS records that show the MTA's address actually belongs to the domain. But my understanding of this is rather superficial, so someone please correct me if I'm wrong.

But what sort of DNS configuration do I need to put in place so that I don't get blacklisted (assuming I don't actually spam anyone)? The MX records already point to Google, and I'd like to keep it this way. So do I just need to define an A record for my internal mail server? Should it show email as coming from a sub-domain, so as not to conflict with the bare domain being managed by google?


Does the following SPF record make sense if I want email from my domain name to be sent by either google's servers or any server with a dns name ending with

"v=spf1 ptr ~all"

How should I set up reverse DNS for my server? If I have an A record that points to my MTA's ip address, does it mean that reverse lookup will only allow emails sent from

share|improve this question
Could you define blocked by Gmail? As far as i know Gmail accepts even high-rated spam content (it always ends up with a spam-label though). – Mark Mar 12 '11 at 7:03
I mean after you send a few emails their server's stop accepting your SMTP authentication and direct you to a CAPTCHA page to unblock your account. – Assaf Lavie Mar 12 '11 at 7:26
Your SPF record should be "v=spf1 ~all" – adamo Mar 12 '11 at 7:46
I summed up the configuration needed for sendmail here:… – adamo Mar 13 '11 at 22:28
up vote 2 down vote accepted

What's stopping anyone from setting up a mail server and sending emails using my domain name?

Nothing actually. That is why recipients setup antispam measures.

But what sort of DNS configuration do I need to put in place so that I don't get blacklisted?

As a first step setup your SPF records to include your MTA and Google's has a simple wizard that helps you on this.

share|improve this answer
I want to send email from an address like: Can I setup reverse DNS with my hosting provider with as the record or must is be And if the latter, won't that necessitate sending email from – Assaf Lavie Mar 12 '11 at 7:16
What is needed for your sending MTA is that its A record and PTR record provide the same information. If the server's name is and it's address then the PTR record for should point to It does not have to be identical to And or its IP address should be included in the SPF record. – adamo Mar 12 '11 at 7:26
Although will work as it redirects to it preferable to use – Mark Mar 12 '11 at 8:18
Mark, thanks for your reply. As shows you are correct. My include was from reading an earlier version of the document which is apparently now deprecated. – adamo Mar 12 '11 at 11:07

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.