简体   繁体   中英

How do I send email with django-registration?

如何发送带有django注册的电子邮件?

django-registration sends an email to the user, eg when he or she registers. The process is as follows (if this was your question ...)*:

  • The user has filled out and submitted the registration form ...

  • in views.py:187

     new_user = backend.register(request, **form.cleaned_data) 
  • in eg backends/default/__init__.py:78

     new_user = RegistrationProfile.objects.create_inactive_user(username, email, password, site) 
  • in models.py:79

     if send_email: registration_profile.send_activation_email(site) 
  • and then in models.py:207

     def send_activation_email(self, site): ... self.user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL) 

The last method call goes into django.contrib.auth , especially django.contrib.auth.models.User.email_user

PS Also, it's crude, but in general a search on the codebase, eg with grep or similar tools can show you things like this.

*changeset 073835a4269f

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM