Fix Python – How to send email via Django?

In my, I have the following:
EMAIL_BACKEND = ‘django.core.mail.backends.smtp.EmailBackend’

# Host for sending e-mail.
EMAIL_HOST = ‘localhost’

# Port for sending e-mail.

# Optional SMTP authentication information for EMAIL_HOST.

My email code:

Fix Python – How to send an email with Python?

This code works and sends me an email just fine:
import smtplib
#SERVER = “localhost”

FROM = ‘’

TO = [“”] # must be a list

SUBJECT = “Hello!”

TEXT = “This message was sent with Python’s smtplib.”

# Prepare actual message

message = “””\
From: %s
To: %s
Subject: %s

“”” % (FROM, “, “.join(TO), SUBJECT, TEX….

Fix Python – How to send an email with Gmail as provider using Python?

I am trying to send email (Gmail) using python, but I am getting following error.
Traceback (most recent call last):
File “”, line 14, in
File “/usr/lib/python2.5/”, line 554, in login
raise SMTPException(“SMTP AUTH extension not supported by server.”)
smtplib.SMTPException: ….

Fix Python – How to send email attachments?

I am having problems understanding how to email an attachment using Python. I have successfully emailed simple messages with the smtplib. Could someone please explain how to send an attachment in an email. I know there are other posts online but as a Python beginner I find them hard to understand.