I have a client who has several email addresses all of which have to be redirected when she goes on holiday. To save work I have set up permanent redirect for all the addresses to firstname.lastname@example.org this one email address can then be redirected to whoever is covering the absence.
The problem is that if email@example.com isn’t currently redirected to a real email address anyone who sends a message to the client will get bounce message.
A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: firstname.lastname@example.org (ultimately generated from email@example.com) No Such User Here"
So I need to redirect to a real address but I don’t actually want to store the messages as the original recipient is already getting a copy. What I need is a “black hole email address”.
A black hole e-mail address is an e-mail address which is valid (messages sent to it will not generate errors), but to which all messages sent are automatically deleted, and never stored or seen by humans. These addresses are often used as return addresses for automated e-mails.
I have found a couple of examples of such things on the internet but they didn’t suit my hosting setup, a reseller account with Hostgator.
There are black hole email services where you send messages you don’t want but I wasn’t happy forwarding a client’s messages to another party. Great for junk mail but I wouldn’t want to send real mail to an unknown recipient.
The cron job solution
With some help from Jason C at Hostgator this is my first solution. If you don’t have CPanel it is a pretty good solution.
- Set up a new email account for (in my case) firstname.lastname@example.org
- Use an FTP program (in my case Filezilla) to find the path to where the incoming emails are being stored. I found them at;
- Set up a cron job to execute the following command;
rm mail/example.com/blackhole/new/*I set it to run every 15 minutes (*/15) which is probably excessive but it depends on how quickly the messages build up.
Pretty simple in the end, just required a bit of thought.
The CPanel Solution
The solution above had been running ok for a few weeks when my client got an automated email;
The following users are near or have exceeded their individual mail quota:
It seems that CPanel doesn’t realise that the emails have been deleted so it doesn’t update the quota, there are nightly quota update jobs which should correct the issue but they don’t seem to work.
But Michael H at Hostgator pointed me in the direction of an another solution (Hostgator support is pretty good but as with most organisations it does depend on who you talk to).
CPanel does offer an alternative to the cron job solution, the User Level Filter, this was something I hadn’t come across before. So now I have set up user level filter to simply delete all messages coming into the blackhole mailbox. I have yet to see if this fixes the quota issue, as both are run by CPanel you would hope that it would but you never know.