tags:

views:

36

answers:

2

Hay, i was wondering how i would go about setting up django so that i can send emails from a standard Leopard installation.

In php i just use mail() and it sends the mail for me.

Thanks

+2  A: 

From the docs:

Mail is sent using the SMTP host and port specified in the EMAIL_HOST and EMAIL_PORT settings. The EMAIL_HOST_USER and EMAIL_HOST_PASSWORD settings, if set, are used to authenticate to the SMTP server, and the EMAIL_USE_TLS setting controls whether a secure connection is used.

So set your EMAIL_HOST to a friendly SMTP server which will relay mail for you, and away you go.

Again, from the docs:

from django.core.mail import send_mail

send_mail('Subject here', 'Here is the message.', '[email protected]',
    ['[email protected]'], fail_silently=False)
Jack M.
For example, I usually just use my gmail account:EMAIL_HOST = 'smtp.gmail.com'EMAIL_PORT = '587'EMAIL_HOST_USER = 'USERNAME'EMAIL_HOST_PASSWORD = 'PASSWORD'EMAIL_USE_TLS = True
Chris Lawlor
This ALWAYS replies with an error - getaddrinfo() argument 1 must be string or None
dotty
@dotty Do you have some example code of what isn't working?
Jack M.