Posts Tagged ‘procmail’

Procmail tip for Vanity emails.

Thursday, August 14th, 2008

As you know, some sites allow you to have a vanity email, (ubuntu.com, kubuntu.org, php.net, debian.org, etc) - Usually - these are setup to forward to another account.

Well, after getting fed up of people spamming my php.net email account by using the address that it’s forwarded to (which I have no idea where it’s coming from) - I eventually decided to get my revenge and write a procmail recipe to get rid of these ;)

:0:
* ! ^Received:.*php.net.*sourceguru.net
.Spam/

This will send anything that does not have a header containing both php.net and sourceguru.net in the header line, and send it to the spam folder, this means that anything sent directly to <alias>@sourceguru.net instead of <nick>@php.net will be sent to spam. Yay! It’s blocked… 5 spam in the time of writing this post.

Obviously, you have to be a bit careful with these things, there are other bits that you could add in, like checking that it was also recieved by <server>.php.net for <nick>@php.net (unfortunately, php.net’s email servers don’t seem to provide the “for” bit of it) - and some other checks. But as a basic rule, it goes pretty far (I wouldn’t send this sorta thing to /dev/null however, there might be false positives)

Also, do be careful if you decide to do this for your @ubuntu.com email address. Until Launchpad has the extra features for setting an email as an alias for your @ubuntu.com email address, and having you @ubuntu.com email address set as your preferred email address at the same time, then Launchpad can and will send emails directly to your alias address… I’ll probably update at some point with a nice procmail ruleset for ubuntu.com email addresses ;)

Hope this helps someone fight spam!

Oh, and of course, it does rely on you having a single email account for the alias, rather than just sending it to an address that you’d normally use!