I'm completely new to DNS and how it work. Lately I've been getting mail spammed like crazy on one of my domain. I'm not using any mail for this domain and don't need it. I don't want to stop it just locally, is there a way to edit DNS so that this domain won't even receive any email whatsoever? Thanks in advance.


If the domain is not supposed to send or recieve email, it should not have an MX record. Spambots may still try to use the A record to locate it and send email to it.

Consider adding and SPF (Sender Policy Framework) record of the form "v=spf1 -all", which will indicate the domain does not send email. DNS has an SPF record type for this, but many tools still look for a TXT record. This should reduce any backscatter spam if the domain is used to send email.

If the domain truly does not send or accept email, there should be no email servers configured to accept email for it. Ensure that your email server rejects all email sent to recipients in that domain. If you are receiving email for the domain, your email server must be configured to accept email for the domain. This is not a DNS solution, but is part of the solution. You mail server should be configured to accept email only for the domain(s) which should be sending and receiving email.

It is best practice to limit the domains participating in email exchanges. Generally this would be the registered domain. Typically, example.com would be the email domain while www.example.com would neither accept nor send email.


You should not do that without the consent of the other party but it is possible to point the MX to a wrong host i.e. one not configured for this domain which will refuse accepting this mail (though I am not sure whether the A record is tried then instead) or to one with a mailserver which just throws everything away. Pointing to a host without a reachable MTA also might result in the sender trying the A record host.

  • This answer is pure nonsense, and even worth flagging: you don't point your MX records to arbitrary IPs, because it's dumb if you're the domain owner and abusive to the receiving IP owner. Bad, bad practice. Imagine what would happen if the receiving IP decides to enable email for the domain? You get all email control for it, which opens up a whole can of worms. Simply remove the MX record like others have said. – drumfire May 18 '16 at 15:23
  • @drumfire A consenting other party is something different than sending mail to an arbitrary IP. – Anthon May 18 '16 at 16:12

A popular technique is to add an MX record that points to the root domain:

yourdomain.com. IN MX 10 .

There's no A record for the root domain, so this should cause a failure. However, spammers may know about this trick, and ignore this MX record.

Another technique that some use is to point it to localhost:

yourdomain.com. IN MX 10 localhost.yourdomain.com.
localhost       IN A

This will cause the sending system to try to send the mail to itself. Again, I wouldn't be surprised if spammers have caught on to this trick as well.

  • You are willing to relinquish control of your domain to another party if you set your MX record to anywhere else - including the root zone. Just remove the MX record, and don't use because it creates problems for legitimate MTAs. – drumfire May 18 '16 at 15:29
  • @drumfire If you remove the MX record, that means to use the A record. – Barmar May 18 '16 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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