7

Greetings,

Does anyone know what are the required fields to have Django send emails when a "500 Internal Server Error" happend? I am hosting my project on Dreamhost and for the life of me I can't get Django to send emails. What are the required fields when hosting on Dreamhost?

letsgofast
  • 257
  • 1
  • 3
  • 7

5 Answers5

17

As proposed by S.Mark, you can use gmail. Here is what you need in your settings.py

ADMINS = (
    ('Your Name', 'your_name@email.com'),
)

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_PASSWORD = 'password'
EMAIL_HOST_USER = 'gmail_account'
EMAIL_SUBJECT_PREFIX = 'something'
EMAIL_USE_TLS = True
luc
  • 41,928
  • 25
  • 127
  • 172
1

Yes, I am, same on dreamhost, but I am using gmail to send email like following sample code

import smtplib

m = smtplib.SMTP("smtp.gmail.com", 587)
m.ehlo()
m.starttls()
m.ehlo()
m.login(USERNAME, PASSWD)
m.sendmail(user, to, "From: %s\nTo: %s\n\nHello World!"%(USERNAME,TOADDR))
m.close()
YOU
  • 120,166
  • 34
  • 186
  • 219
  • I was trying to use Dreamhost's server's. From what I can tell they require User Name\Password Auth'. When I do something like: from django.core.mail import send_mail >>> send_mail('Hi there', 'My Message', 'webmaster@mydomain.com', ['webmaster@mydomain'], fail_silently=False) I get a SMTP AUTH extension not supported by server response from their server. If I try with no User Name and Password I get 'Relay access denied'. – letsgofast Dec 21 '09 at 07:06
0

Try to use:

EMAIL_HOST = "localhost"

instead of DNS resolution...

DenisKolodin
  • 13,501
  • 3
  • 62
  • 65
0

Do you have an SMTP server set up anywhere? As people have suggested here, you can easily use gmail, but you are by no means limited to using only Gmails SMTP server. You can create your own on your own hardware if you like, or you can use a number of free SMTP servers out there. I'd say the most fun would be to set up your own box and make your own SMTP server ;)

Paul D. Waite
  • 96,640
  • 56
  • 199
  • 270
shawnjan
  • 959
  • 7
  • 16
  • 1) It's SMTP, not SMPT. 2) In my experience, maintaining SMTP servers is a hassle. If you can get away with using an existing reliable server, I would do that. – drxzcl Dec 21 '09 at 10:25
0

One issue we seem to have found with this gmail work around, is that if you try testing by sending from a gmail account to a dreamhost email that forwards back to the same gmail, the message is dropped. This may be some weird security 'feature' that dreamhost has going.

The Mad Gamer
  • 253
  • 2
  • 6