Django-allauth: 电子邮件确认

4
我已经安装了Django-allauth,并使用电子邮件确认来注册新用户,这很好用。但是在确认电子邮件中,我得到了以下信息:
Hello from example.com!

    You're receiving this e-mail because user abc13 at example.com has given yours as an e-mail address to connect their account.

    To confirm this is correct, go to http://<mysite>.com/accounts/confirm-email/q3rknxpflshgwddlbjw6aqzlr1ayqtnfrtezucoq2ysmfbm2etcldusq5dyrcoap/

    Thank you from example.com!
    example.com

我该如何用我的网站名称替换“example.com”?谢谢。
2个回答

16

听起来您需要在Django管理后台更新Site条目。您可以通过以下方式访问:


http://<yoursite>.com/admin/sites/site/

请在settings.py中添加SITE_ID,并将django.contrib.sites添加到installed_apps中,否则我们会收到一个带有提示的错误。这是一个非常好的错误信息,因为它直接告诉我们需要将django.contrib.sites添加到installed_apps中。 - Willy satrio nugroho

2
您可以使用以下方式创建完全自定义的电子邮件:
您可以使用类似以下内容的电子邮件:
@receiver(user_signed_up)
def user_signed_up_(sender,request,user,**kwargs):

    subject, from_email, to = 'Welcome', 'admin@mysite', 'person@somewhere'
    text_content ="some custom text or html"
    msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
    msg.attach_alternative(html_content, "text/html")
    msg.send()

这个函数应该放在哪里? - ealeon
如果您这样做,您需要在settings.py中禁用默认电子邮件。 - charlie6411

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接