Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.template import Context
- from django.template.loader import render_to_string, get_template
- from django.core.mail import EmailMessage
- def sendmail(request):
- ctx = {
- 'user': "Shin"
- }
- message = get_template('mail.html').render(ctx)
- msg = EmailMessage(
- 'Subject',
- message,
- ['[email protected]'],
- )
- msg.content_subtype = "html" # Main content is now text/html
- msg.send()
- print("Mail successfully sent")
Add Comment
Please, Sign In to add comment