[Email-SIG] smtplib and getting a copy ?

Oleg Broytmann phd at mail2.phd.pp.ru
Fri Apr 14 19:19:19 CEST 2006


On Fri, Apr 14, 2006 at 12:12:50PM -0500, Lukasz Szybalski wrote:
> One last question.
> Is there an easy way to covert body of an email into lines starting with ">"
> 
> If I received in my payload(), body of an email:
> hello
> how are you
> 
> I want to send a response with quoted part:
> hi
> >hello
> >how are you

body = message.get_payload()
answer = ["> %s" % line for line in body.split('\n')]
reply = '\n'.join(answer)

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.


More information about the Email-SIG mailing list