关于发邮件报错535 Error:authentication failed解决方法

smtplib.SMTPAuthenticationError: (535, ‘Error: authentication failed’)

用163邮箱服务器来发送邮件,我们需要开启POP3/SMTP服务,这时163邮件会让我们设置客户端授权码,这个授权码替代上面代码部分的passwd即可成功发送邮件

关于发邮件报错550 Error:user has no permission解决方法

原因一:properties里是否存放了 mail.smtp.auth= true
原因二:邮箱没有开通POP3/SMTP协议

发送邮件部分代码

EMAIL_BACKEND = ‘django.core.mail.backends.smtp.EmailBackend’
EMAIL_USE_TLS = True
EMAIL_HOST = ‘smtp.163.com’
EMAIL_PORT = 25
EMAIL_HOST_USER = ‘[email protected]
EMAIL_HOST_PASSWORD = ‘**
DEFAULT_FROM_EMAIL = ‘[email protected]

def sendmsg(request):
send_mail(subject, message,’[email protected]’,[‘[email protected]’],fail_silently=False)
return HttpResponse(“发送邮件成功!”)

你可能感兴趣的:(网络协议,算法)