django-allauth - Send email verification using Gmail account

╄→尐↘猪︶ㄣ 提交于 2019-12-22 09:55:16

问题


I have setup allauth to send out an email for every new registered user so that their email can be verified. Right now I use the email_backend so that the email is sent to the terminal instead, and everything works fine.

But now I want to can set it all up so that an email is sent, and since I will (likely) not have a local email server at the host server, but instead use for example an gmail account to send the verification email. Is this at all possible?


回答1:


Of course you can set your gmail account to send emails. Just set these settings for django:

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = DEFAULT_FROM_EMAIL = 'gmail account'
EMAIL_HOST_PASSWORD = 'gmail password'



回答2:


You can use the following settings into your settings.py file

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '%%%%%%%%%%%%%%%'
EMAIL_HOST_PASSWORD = '%%%%%%%'
EMAIL_PORT = 587


来源:https://stackoverflow.com/questions/31743396/django-allauth-send-email-verification-using-gmail-account

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!