def send_welcome_message(http_host, email): user = User.objects.get(email=email) html = render_to_string_html('registration/mail/welcome.html', dict(user=user, http_host=http_host)) body = render_to_string_text('registration/mail/welcome.txt', dict(user=user, http_host=http_host)) msg = EmailMultiAlternatives(strings.SEND_WELCOME_MESSAGE, body, constants.FROM_WELCOME_EMAIL, [email]) msg.attach_alternative(html, 'text/html') msg.send()
def send_confirmation(http_host, email): user = User.objects.get(email=email) token = RecoveryToken.objects.create(user=user) html = render_to_string_html("authentication/mail/email_confirmation.html", dict(token=token, http_host=http_host)) body = render_to_string_text("authentication/mail/email_confirmation.txt", dict(token=token, http_host=http_host)) msg = EmailMultiAlternatives( strings.SEND_CONFIRMATION_SUBJECT, body, constants.FROM_PASSWORD_RECOVERY_EMAIL, [email] ) msg.attach_alternative(html, "text/html") msg.send()
def send_confirmation(http_host, email): user = User.objects.get(email=email) token = RecoveryToken.objects.create(user=user) html = render_to_string_html('authentication/mail/email_confirmation.html', dict(token=token, http_host=http_host)) body = render_to_string_text('authentication/mail/email_confirmation.txt', dict(token=token, http_host=http_host)) msg = EmailMultiAlternatives(strings.SEND_CONFIRMATION_SUBJECT, body, constants.FROM_PASSWORD_RECOVERY_EMAIL, [email]) msg.attach_alternative(html, 'text/html') msg.send()
def run(self, user): total_automatches = user.automatch_set.count() if total_automatches == 0: return html = render_to_string_html( 'matches/mail/periodic_automatch_email.html', dict(user=user, total_automatches=total_automatches, http_host=settings.DOMAIN_NAME)) body = render_to_string_text( 'matches/mail/periodic_automatch_email.txt', dict(user=user, total_automatches=total_automatches, http_host=settings.DOMAIN_NAME)) msg = EmailMultiAlternatives( strings.SEND_PERIODIC_AUTOMATCHES_EMAIL_SUBJECT % total_automatches, body, constants.FROM_PERIODIC_AUTOMATCHES_EMAIL, [user.email]) msg.attach_alternative(html, 'text/html') msg.send()