Counting how often an email alias is used

Tom Metro tmetro-blu-5a1Jt6qxUNc at public.gmane.org
Sun Jan 10 02:31:21 EST 2010


Bill Horne wrote:
> One of the nicest things about having my own server is that it gives me
> an inexhaustible supply of throwaway email addresses. However, my
> /etc/aliases file has grown to the point that it's no longer convenient
> to manage....

1. Use address extensions, not system-wide aliases.
2. Use a database.

I have an experimental MySQL stored procedure that gets used by both 
Postfix and Dovecot Deliver to qualify mailboxes and map them to a file. 
It handles multiple levels of extensions, and searches for a match from 
specific to generic. So for example, an address like user-ads-amazon 
will first try and see if there is a mailbox matching the full string, 
then user-ads, then user. (I believe qmail implemented the same thing 
eons ago.)

Still needed is some UI to list and manage the extension-to-mailbox 
mapping, and the ability to invalidate an extension (send it to 
/dev/null) if it gets abused. I'd like to add a comment field to the 
record as well, so the user can record a reminder of what the alias was 
created for.

Currently you can make up addresses on the spot, which is convenient, 
but a fairly simple change could be made so that every extension has to 
be pre-declared, thus preventing spamming to user-<random> from ending 
up in the general inbox.


> ...and I'd like to count when each alias is used.

You mean count each time an email is received for a given address? Post 
processing MySQL logs, or having the stored procedure update a counter 
would do it. You can also grep your archives, if your MTA preserves the 
original recipient in the Delivered header.

I have an anti-spam SMTP proxy that counts address use, but only for 
addresses that are invalid (as it is looking for common spam client 
behavior of sending mail to bogus addresses).

  -Tom

-- 
Tom Metro
Venture Logic, Newton, MA, USA
"Enterprise solutions through open source."
Professional Profile: http://tmetro.venturelogic.com/





More information about the Discuss mailing list