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
Post a Comment