from django.core.mail impore EmailMessage
in your settings.py put the following:
EMAIL_HOST defines the host for sending email
EMAIL_PORT defines the port for sending email
EMAIL_HOST_USER (optional)used to authenticate to the smtp server
EMAIL_HOST_PASSWORD (optional) also used to authenticate to the smtp server
EMAIL_USE_TLS (True/False) controls whether a secure connection is used
create an EmailMessage object
email = EmailMessage('Title', 'Body', 'from@email.com',
['to@email.com'], ['bcc@email.com'],
headers = {'Reply-To': 'someone@anonymous.com'})
send email
email.send(fail_silently=True)
or
email.send(fail_silently=False)
or
email.send()
No comments:
Post a Comment