从python代码发送电子邮件的非常简单和unicode友好的方式。
send_email_message的Python项目详细描述
用法:
sudo pip install send_email_message from send_email_message import send_email_message email_config = dict( host='smtp.gmail.com', port=587, tls=True, // Or ssl=True with another port. user='admin@example.com', password='password', from_name='Example Site', # Default: encoding='utf-8' ) send_email_message( to='denisr@denisr.com', subject='Example News', text='Please see http://example.com/', html='<html><body>Please see <a href="http://example.com/">example.com</a></body></html>', **email_config )
罕见用法:
login_plain=True, # Some servers are OK with TLS, but require "LOGIN PLAIN" auth inside encrypted session. debug=True, # Enables debug output.