django部署到云服务发送邮件失败
本地测试发送邮件能够成功,配置如下
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.163.com'
EMAIL_PORT = 25
EMAIL_HOST_USER = 'jixxx99@163.com'
EMAIL_HOST_PASSWORD = 'xxx'
CONFIRM_DAYS=2
ACTIVE_HOST="http://www.ssjt21.top/"
当换到云服务器时就发送不成功,经过查询资料,了解到,服务器默认关闭25端口的发送邮件,默认使用ssl的465端口的发送邮件
服务器部署需要的配置如下:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.163.com'
#EMAIL_PORT = 25
EMAIL_PORT = 465
EMAIL_HOST_USER = 'jixxx9@163.com'
EMAIL_HOST_PASSWORD = 'xxxx'
EMAIL_USE_SSL = True
CONFIRM_DAYS=2