在Django中配置发送邮件服务(gmail和163邮箱)

gmail出现认证问题参考:https://segmentfault.com/q/1010000008458788

163邮箱配置

EMAIL_HOST = 'smtp.163.com'
EMAIL_PORT = 465
EMAIL_HOST_USER = 'xxx'
EMAIL_HOST_PASSWORD = 'xxx'.  # 这里是授权码
# 下面两项只能有一个为True
EMAIL_USE_TLS = False
EMAIL_USE_SSL = True

gmai配置

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'xxx'
EMAIL_HOST_PASSWORD = 'xxx'
# 下面两项只能有一个为True
EMAIL_USE_TLS = True
EMAIL_USE_SSL = False
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

你可能感兴趣的:(环境配置,django)