Does anyone had success getting Django to send emails when hosting on Dreamhost?
Asked Answered
E

5

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?

Eastereasterday answered 21/12, 2009 at 6:57 Comment(0)
P
17

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

ADMINS = (
    ('Your Name', '[email protected]'),
)

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
Ploughboy answered 21/12, 2009 at 7:6 Comment(1)
You may want also to throw the following in there: EMAIL_USE_TLS = TrueBrannan
O
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()
Optimum answered 21/12, 2009 at 7:3 Comment(1)
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', '[email protected]', ['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'.Eastereasterday
B
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 ;)

Bolero answered 21/12, 2009 at 10:7 Comment(1)
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.Rondeau
M
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.

Missi answered 17/9, 2010 at 19:38 Comment(0)
V
0

Try to use:

EMAIL_HOST = "localhost"

instead of DNS resolution...

Virile answered 6/7, 2012 at 19:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.