Beispiel #1
0
def send_reset_email(message,email):
    from django.conf import settings
    content_type = getattr(settings, 'REGISTRATION_EMAIL_FORMAT','plain')
    if content_type == 'plain':
        template = 'password_reset.txt'
    else:
        template = 'password_reset.html'
    subject=u'Восстановление пароля'
    send_email(subject,template,email,content_type,message=message)
Beispiel #2
0
 def send_activation_email(self):
     from django.conf import settings
     content_type = getattr(settings, 'REGISTRATION_EMAIL_FORMAT','plain')
     subject = getattr(settings, 'REGISTRATION_EMAIL_SUBJECT', u'Регистрация на сайте {0}')
     if content_type == 'plain':
         template = 'activation.txt'
     else:
         template = 'activation.html'
     subject = subject.format(Site.objects.get_current().name)
     send_to = self.user.email
     name = self.user.first_name if self.user.first_name else self.user.username
     message = {'user':{'activation_key':self.activation_key,'username':name}}
     send_email(subject,template,send_to,content_type,message=message)