flaskフレームワーク126メールボックスでメール
1191 ワード
app.config['SECRET_KEY'] = "you dont kown"
app.config['MAIL_SERVER'] = 'smtp.126.com'
app.config['MAIL_PORT'] = 25
app.config['MAIL_USE_TLS'] = False
app.config['MAIL_USE_SSL'] = False
app.config['MAIL_USERNAME'] = '[email protected]'
app.config['MAIL_PASSWORD'] = 'xxxx'
$ python hello.py shell
>>>
from
flask.ext.mail
import
Message
>>>
from
app
import
mail
>>>
>>> msg
=
Message(
'test subject'
, sender
=
'[email protected]'
, recipients
=
["[email protected]"] )
>>> msg.body
=
'text body'
>>> msg.html
=
'<b> </b> '
>>> mail.send(msg)
OK