Django smtp 邮件 553报警

用163smtp发邮件时候一直报警553权限问题

smtplib.SMTPSenderRefused: (553, b'Mail from must equal authorized user', 'webmaster@localhost')

经过指点以后发现,发送邮件时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 = '可加可不加'

你可能感兴趣的:(Python,Django)