“Enviando e -mail em django” Respostas de código

Enviando e -mail em django

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
Creepy Cardinal

Email django

from django.core.mail import EmailMultiAlternatives
from django.template.loader import get_template
from django.template import Context

plaintext = get_template('email.txt')
htmly     = get_template('email.html')

d = Context({ 'username': username })

subject, from_email, to = 'hello', '[email protected]', '[email protected]'
text_content = plaintext.render(d)
html_content = htmly.render(d)
msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
msg.attach_alternative(html_content, "text/html")
msg.send()
Juan Gt

Respostas semelhantes a “Enviando e -mail em django”

Perguntas semelhantes a “Enviando e -mail em django”

Mais respostas relacionadas para “Enviando e -mail em django” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código