| jclement.ca · datedmail.py | [ Home · Photoblog (Flickr) · Software · Search Site ] |
| datedmail.py | [ Home · Photoblog (Flickr) · Albums · Photography · Woodworking · Software · Search Site ] |
| Version: | 1.0 |
| Author: | Jeff Clement |
| Status: | Active |
A Python application for managing time limited e-mail addresses with Qmail. What, I think, separates this tool from the others are shorted generated address, very minimal dependencies (python and that's it), and it's one single app used by qmail and to generate addresses that includes all configuration (ie. easy to run on client and server machine).
datemail.py allows you to create addresses that expire after a certain amount of time. Basically it generates e-mail address that look like joe-dated-030101-3de@domain.com. The joe-dated part is simply a prefix for the address. The important part is the "030101-3de". This is the address expirey date followed by a short hash of the date and your secret key.
So basically we configure datemail.py to setup our secret key and e-mail address info and expirey date. Once that is done we copy it onto our mailserver into our users home directory or somewhere and create a .qmail file (see below) that calls this. We also keep a copy of datedmail.py on our desktop for creating new addresses when we want to fill out online forms, do usenet posts, etc.
So for example: I want to post to usenet but I know if I do that I'll be spammed mercilously for the rest of my days. So I generate a new e-mail address by calling:
./datedmail.py -g
And it returns something like:
user-dated-030101-3de@domain.com
I now post my message to usenet but use this address as my From address (and reply to and any signatures, etc). Now anyone can reply to this message but datedmail.py being called from your .qmail is making sure that it will only accept messages for a limited number of days. After that point any incoming messages are bounced saying that the address has expired and, at your option, a new address they can use to reach you. Now if we could only do this for postcards.
This system is very simple and should help reduce the amount of spam you receive.
This system is fairly secure. The addresses it generates include the expirey date and a part of a MD5 hash of that date and your secret word. Depending on the size of your key and the number of characters of the hash that you wish to include, the likelyhood of some spammer guessing your new address ranges from really slim to none.
I use Mutt for my e-mail and I wanted a quick way of forcing the from address to a time limited one for certain e-mail messages I was composing. The solution was adding the following to my .muttrc:
macro compose \Cd <edit-from>\Cu"Jeff Clement <`/home/jsc/bin/datedmail.py -g`>"<enter> 'Dated Message'
So when I compose a message. In the final screen that lets you tweak the destination, subject, message, attachments, etc you can hit Ctrl+D to replace from default from address with a time limited one. And the cool part is it's only for that message so you won't accidentally start sending out time limited addresses to your buddies.
Simply open up the datedmail.py file in your favorite text editor and edit the options near the top of the file. It should be fairly clearly marked. You configure how long the addresses are good for, what your address should look like and the unique key for your dated addresses. Now all your config is stored in this Python script you can run on client / server / etc.
Say we have a user joe who wants a dated address like joe-dated-*@domain.com that forwards good messages to joe@domain.com. We would simply create the file ~joe/.qmail-dated-default containing:
|/home/domain/datedmail-joe.py -q joe@domain.com
That's it.
This is essentially the same except now we have multiple e-mail accounts under the same Unix user. No problem. Say we want to setup joe-dated-*@domain.com where user "domain" handles e-mail for "domain.com". We create the file ~domain/.qmail-joe-dated-default containing:
|/home/domain/datedmail-joe.py -q joe@domain.com
Simple :)
This software is licensed under the BSD license. Please make sure you have read and understood this license before downloading this software!
Copyright (c) 2003, Jeffrey Clement All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| File | Size | Last Modified |
|---|---|---|
| datedmail.py-1.0-src.tar.gz | 6.42 kb | Thu Sep 23 05:52:28 2004 |
| datedmail.py-1.0-src.tar.gz.asc | 0.18 kb | Thu Sep 23 05:52:27 2004 |
| datedmail.py-snapshot.tar.gz | 6.42 kb | Thu Sep 23 05:52:28 2004 |