简体   繁体   中英

Django email configuration with Bluehost email server

I am new to Bluehost and Django and I am trying to setup a "password reset via email" function on my Bluehost server with Django. I've tried different combinations on setting the host and port number but for some reason it never worked. So here's what I had: (I am currently only working on my local computer.)

On Bluehost website where I can configure my email account, it lists:

Manual Settings

  • Mail Server Username: admin+my_host.com
  • Incoming Mail Server: mail.my_host.com
  • Incoming Mail Server: (SSL) box664.bluehost.com
  • Outgoing Mail Server: mail.my_host.com (server requires authentication) port 26
  • Outgoing Mail Server: (SSL) box664.bluehost.com (server requires authentication) port 465
  • Supported Incoming Mail Protocols: POP3, POP3S (SSL/TLS), IMAP, IMAPS (SSL/TLS)
  • Supported Outgoing Mail Protocols: SMTP, SMTPS (SSL/TLS)

In settings.py I have the emails configured as: (I will list two combinations and the corresponding error message)

combination 1

DEFAULT_FROM_EMAIL  = 'admin@my_host.com'
SERVER_EMAIL = 'admin@my_host.com'
EMAIL_USE_TLS   = False
EMAIL_HOST      = 'box664.bluehost.com'
EMAIL_HOST_PASSWORD = 'my_email_password'
EMAIL_HOST_USER = 'admin+my_host.com'
EMAIL_PORT      = 465
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

error message: Exception Value: Connection unexpectedly closed

combination 2

DEFAULT_FROM_EMAIL  = 'admin@my_host.com'
SERVER_EMAIL = 'admin@my_host.com'
EMAIL_USE_TLS   = True
EMAIL_HOST      = 'mail.my_host.com'
EMAIL_HOST_PASSWORD = 'my_email_password'
EMAIL_HOST_USER = 'admin+my_host.com'
EMAIL_PORT      = 26
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

error message: Exception Value: (535, 'Incorrect authentication data')


Could anyone give me some suggestions where I did wrong? Any help is appreciated.

The following settings:

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = False
EMAIL_HOST = 'mail.yourdomain.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'no-reply@yourdomain.com'
EMAIL_HOST_PASSWORD = 'password'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER

worked for me. My django version I tested with is 1.8.8. Bluehost smtp settings details are explained here .

I exactly dunno what the problem is, but I have faced the same problem. I think it has something to do with SMTP/SSL. So what I used this: https://github.com/perenecabuto/django-sendmail-backend

Then I used this configuration in settings.py:

    EMAIL_USE_SSL = False
    EMAIL_USE_TLS= False
    EMAIL_HOST = 'box###.bluehost.com'
    EMAIL_PORT = 465
    EMAIL_HOST_USER = 'someone@example.com'
    EMAIL_HOST_PASSWORD = 'password'

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM