Skip to content

Instantly share code, notes, and snippets.

@mikehenriquezf
Created September 10, 2012 18:59
Show Gist options
  • Save mikehenriquezf/3692982 to your computer and use it in GitHub Desktop.
Save mikehenriquezf/3692982 to your computer and use it in GitHub Desktop.
def welcome_notifications(user, entrypoint):
# ===== Welcome email =====
subject = _('Welcome to %(entrypoint_name)s') % {'entrypoint_name': entrypoint.name}
from_email = settings.DEFAULT_FROM_EMAIL
to = user.email
context = {
'user': user,
'entrypoint': entrypoint
}
text_content = render_to_string('email/welcome.txt', context)
html_content = render_to_string('email/welcome.html', context)
msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
msg.attach_alternative(html_content, "text/html")
msg.send()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment