header - Setting Return-Path with Python sendmail for a MIME message -


hi set "return-path" header mime message send python. basically, tried :

message = mimemultipart() message.add_header("return-path", "something@something.com") #...  smtplib.smtp().sendmail(from, to, message.as_string()) 

the message receive have "return-path" header set same content "from" one, if explicitly add "return-path" header.

how can set "return-path" header mime message sent through smtplib's sendmail in python ?

thanks in advance.

return-path set smtp protocol, it's not derived message itself. it'll envelope address setups.

the proper way accomplish is:

msg = email.message_from_string('\n'.join([     'to: michael@mydomain.com',     'from: michael@mydomain.com',     'subject: test email',     '',     'just testing' ])) smtp = smtplib.smtp() smtp.connect() smtp.sendmail('something@something.com', 'michael@mydomain.com', msg.as_string()) 

Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -