29

I'm searching for an equivalent of a sinkhole email address. Essentially, I need a discard mechanism similar to /dev/null or the non-routed range 240.0.0.0/4.

Options like null@, devnull@, or none@ seem plausible, but there's a concern that these addresses might already be in use.

Is there a de facto standard for this specific use case?

Update:

Some comments points to use <> and :; as destination address, but any of them produce a response 501 5.1.3 Bad recipient address syntax on a Postfix MTA:

<-  250 2.1.0 Ok
 -> RCPT TO:<:;>
<** 501 5.1.3 Bad recipient address syntax
 -> QUIT
<-  221 2.0.0 Bye

and:

<-  250 2.1.0 Ok
 -> RCPT TO:<<>>
<** 501 5.1.3 Bad recipient address syntax
 -> QUIT
<-  221 2.0.0 Bye

Also, a blank space have the same response:

<-  250 2.1.0 Ok
 -> RCPT TO:< >
<** 501 5.1.3 Bad recipient address syntax
 -> QUIT
<-  221 2.0.0 Bye

From the client side, it must look fine, receiving a 250 2.0.0 O like sending content to /dev/null:

$ echo test > /dev/null && echo $?
0
3
  • 2
    Is there a reason you don't use a .forward file for a user on your server (say bin) to get rid of it?
    – Joshua
    Feb 28 at 21:58
  • 9
    example.com is a reserved, non-usable domain. It's my goto for forms: [email protected].
    – Kingsley
    Feb 29 at 6:42
  • 2
    What is the use case? Is it something you want/need to setup on your own (destination) domain? Or is it something you want to find on any domain? Do you actually need the e-mail to be "received" (and acknowledged with a 250) or just want to make sure it does not bother anyone?
    – jcaron
    Mar 1 at 10:50

4 Answers 4

25

Options like null@, devnull@, or none@ seem plausible, but there's a concern that these addresses might already be in use.

None of those are standard and they indeed might be already in use.

As far as I know, there is no special address that would guarantee non-delivery when sending to arbitrary random domainsany syntactically-valid "local-part" is equally valid for delivery, and only the receiving MTA can decide whether to accept it; the sending MTA cannot refuse based on local-part.

So in all cases, you'll have to decide on a specific (sub)domain first.

Suggestions:

  • Set up an MTA at your own domain name (or a subdomain thereof; you can put MX records on subdomains). You'll then have a guarantee that e.g. null@ will not be in use at that particular domain. Of course, the sender will still try to contact you, but you can literally alias that mailbox to /dev/null on your end.

  • There is now a recent convention of creating a "null MX" record on domains that are explicitly never expected to receive email (as opposed to domains that have no MX records, in which case the domain would be implicitly its own MX). If you create a single MX record that points to the server ., this will cause many new MTAs to automatically fail delivery. Again, you can use a subdomain for this instead of dedicating a whole domain.

    example.com (and .net, and .org) is a real domain that exists, but is reserved for usage in examples and documentation (i.e. it'll never have real mailboxes); as part of that, it actually has a "null MX" record.

  • There are reserved domains, such as [anything].invalid, which will never exist in DNS at all (not even as null-MX) and therefore your origin MTA will immediately fail delivery.

5
  • 1
    Having the MTA dump the message is better than using an invalid address on the domain. This is better than my answer.
    – squillman
    Feb 27 at 14:56
  • @squillman: There's probably not much of a difference, as long as there's a guarantee the address is actually non-existent – but there's no way to guarantee that an arbitrary domains won't have a catch-all mailbox set up... Feb 27 at 14:59
  • Right, there's no guarantee unless you have complete control over the domain. With as much convention as is typically applied to mail addresses it's usually pretty safe, but not guaranteed.
    – squillman
    Feb 27 at 15:47
  • 6
    I disagree that there’s not much of a difference between using an address that explicitly drops everything and an invalid address. Invalid addresses usually generate a DSN, especially if the domain itself is invalid, while using a functioning address that simply drops everything does not. Feb 28 at 11:18
  • 1
    Considering how many companies send out email that says things like "Do not reply to this message, the address is not monitored", it's kind of surprising there isn't even a de factor standard for this.
    – Barmar
    Feb 28 at 17:02
13

Since the question mentions Postfix MTA, here is how to set up Postfix to have a particular address behave as if it was an equivalent of /dev/null.

The Postfix comes with a discard mail delivery agent, which is described as:

The discard(8) delivery agent pretends to deliver all recipients in the delivery request, logs the "next-hop" destination as the reason for discarding the mail, updates the queue file, and either marks recipients as finished or informs the queue manager that delivery should be tried again at a later time.

An e-mail address can be configured to be handled by the discard agent by using the transport maps:

/etc/postfix/main.cf:

transport_maps = hash:/etc/postfix/transport

/etc/postfix/transport:

[email protected]    discard:

Then execute postmap /etc/postfix/transport to create indexed file of the transport database and reload the Postfix daemon (the command for reloading or restarting a daemon could vary depending on the operating system being used).

As a result, Postfix will discard mail addressed to [email protected].

Mail for entire domain or subdomains can be discarded in this way:

/etc/postfix/transport:

# discard all mail to domain 'example.com':
example.com    discard:

# discard all mail to subdomains of 'example.com':
.example.com   discard:
4

Not sure about any de facto standard, but I usually just use an address starting with noreply-. All you really need to do is make sure that the address you use does not exist in the domain.

It's not exactly like /dev/null in that an MTA will still try to route it instead of just dumping it, but it does end up going nowhere.

3
  • 5
    I would argue this is very much not the same as /dev/null. Because the target server will report an error and you’ll get it in your inbox.
    – Daniel B
    Feb 27 at 14:53
  • Yeah, no argument. I get around it with mailbox rules, but it's a valid point.
    – squillman
    Feb 27 at 14:57
  • I'm also usually doing this from within code so there's no mailbox for it to come back to.
    – squillman
    Feb 27 at 15:29
4

Consider using an email address at Example.com (Wikipedia, RFC 2606).

1
  • 2
    This was already suggested in u1686_grawity's answer.
    – gre_gor
    Feb 29 at 10:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .