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

后端 未结 5 1790
无人共我
无人共我 2021-02-04 17:53

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 an

相关标签:
5条回答
  • 2021-02-04 18:03

    Try to use:

    EMAIL_HOST = "localhost"
    

    instead of DNS resolution...

    0 讨论(0)
  • 2021-02-04 18:13

    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
    
    0 讨论(0)
  • 2021-02-04 18:20

    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 ;)

    0 讨论(0)
  • 2021-02-04 18:22

    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.

    0 讨论(0)
  • 2021-02-04 18:26

    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()
    
    0 讨论(0)
提交回复
热议问题