miguelgrinberg / flasky

Companion code to my O'Reilly book "Flask Web Development", second edition.
MIT License
8.54k stars 4.21k forks source link

Mail from must equal authorized user? #540

Open liuende501 opened 2 years ago

liuende501 commented 2 years ago

FLASKY_MAIL_SENDER is Flasky Admin <flasky@example.com> in project. If i use my email address, then throw a exception like

smtplib.SMTPSenderRefused: (553, b'Mail from must equal authorized user', '=?utf-8?q?Flasky_Admin?= <xxx@126.com>')

a simple advice, set FLASKY_MAIL_SENDER like

FLASKY_MAIL_SENDER = os.environ.get('FLASKY_MAIL_SENDER', 'Flasky Admin flasky@example.com')

miguelgrinberg commented 2 years ago

This is not a requirement of this application, it is your email server that is enforcing this and not letting you put any user in the From field of the email.

liuende501 commented 2 years ago

I tried two type of Email that are very popular in China, QQ and 126, all throw exception. Maybe the email server in China all have this restrict.

Thank you for your reply!