1. 程式人生 > >Django smtp 郵件 553報警

Django smtp 郵件 553報警

用163smtp發郵件時候一直報警553許可權問題smtplib.SMTPSenderRefused: (553, b'Mail from must equal authorized user', '[email protected]')
經過指點以後發現,傳送郵件時DEFAULT_FROM_EMAIL這一個設定必須寫,而且內容和EMAIL_HOST_USER需要一致!
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.163.com'
EMAIL_PORT = 25  # 埠號
EMAIL_HOST_USER = 'email address'
EMAIL_HOST_PASSWORD = '授權碼'
DEFAULT_FROM_EMAIL = '這一項一定需要新增'
EMAIL_FROM = '可加可不加'