Email Setup


settings.py - /path/projectdir/theproject
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'mail.activetechsystems.com'
EMAIL_HOST_USER = 'postmaster@activetechsystems.com'
EMAIL_HOST_NAME = 'ActiveTech Systems'
EMAIL_HOST_PASSWORD = 'pwd'
EMAIL_PORT = 465
EMAIL_USE_SSL = True

views.py - /path/projectdir/theapp - Django EmailMessage Docs
from django.core.mail import EmailMessage
from django.conf import settings

email = EmailMessage(
    "Subject 123",
    "<h1>Message 456</h1>",
    "support@activetechsystems.com",
    ["user@gmail.com"],
    [], # bcc
    reply_to=[settings.EMAIL_HOST_NAME + " <support@activetechsystems.com>"],
    headers={"From":  settings.EMAIL_HOST_NAME + " <" + settings.EMAIL_HOST_USER + ">", "Content-Type": "text/html; charset='iso-8859-1'", "X-Priority": "1 (Highest)", "X-MSMail-Priority": "High", "Importance": "High" },
)
email.content_subtype = "html"
# email.attach_file('/var/www/activetech/apps/django/static/img/time.png') # attachment

email.send()