목차

django email

설정

GMail SMTP 서버
GMail의 SMTP 서버를 이용하기 위해서는 두 가지 설정을 해줘야한다

코드

snippet.python
from django.core.mail import send_mail
 
send_mail(
    'Subject here',
    'Here is the message.',
    '[email protected]',
    ['[email protected]'],
    fail_silently=False,
)
snippet.python
from django.core.mail import EmailMessage
 
email = EmailMessage(
    'Hello',
    'Body goes here',
    '[email protected]',
    ['[email protected]', '[email protected]'],
    ['[email protected]'],
    reply_to=['[email protected]'],
    headers={'Message-ID': 'foo'},
).send()

출처


관련 문서