email auto-responder

Gerhard Haering gerhard.haering at gmx.de
Fri Aug 2 13:38:32 CEST 2002


Clemens Hermann wrote:
> Hi Cameron
> 
> thanks for your reply!
> 
>> Help us understand.  I generally think of autoresponder
>> technology in terms of the mail transfer agent and mail
>> delivery agent involved--sendmail and procmail, 
> 
> yupp, almost everything I found concerning the issue is dealing with
> this situation but my starting point is different.
> 
>> Or are you saying you have an existing mail 
>> user agent (POP3-based, perhaps?)--a client--that you 
>> like, and you want to beef it up with Python to create
>> an autoresponder?
> 
> yes. I get the mails via pop3 and getmail
> http://www.qcc.ca/~charlesc/software/getmail-2.0/ which is also
> written in python to read them with mutt later.
> So I can not do it the "mta way of autoresponding" because the
> envelope sender has gone yet.

You could patch getmail to add the envelope FROM as an additional X-header, for
example X-Envelope-FROM.

You'll want the email module in Python 2.2+ to add the additonal header line.
Alternatively, you could use the rfc822 module directly. Or do "the simplest
thing that could possibly work", which is to just do something like:

    old_mail = ...
    envelope_from = ...
    new_mail = "%s\n%s" % ("X-Envelope-From: " + envelope_from, old_mail)

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



More information about the Python-list mailing list