Radek
Radek

Reputation: 1189

Sending Godaddy email via Django using python

I have these settings

EMAIL_HOST = 'smtpout.secureserver.net'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'password'
DEFAULT_FROM_EMAIL = '[email protected]'
SERVER_EMAIL = '[email protected]'
EMAIL_PORT = 465
EMAIL_USE_TLS = True
SMTP_SSL = True

Speaking to Godaddy I have found out these are the ports and settings

smtpout.secureserver.net
ssl
465

587
TLS ON

3535
TLS ON

25
TLS ON

80
TLS ON
or
TLS OFF

I have tried all the combinations. If I set TLS to True I am getting

STARTTLS extension not supported by the server.

If I set to 465 I am getting

Connetion Closed

If I set other combinations like

EMAIL_HOST = 'smtpout.secureserver.net'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'password'
DEFAULT_FROM_EMAIL = '[email protected]'
SERVER_EMAIL = '[email protected]'
EMAIL_PORT = 25
EMAIL_USE_TLS = False

Invalid Address

For verification, I used Google Mail settings to test if the email sending via python works, and it is working.

Now I want to switch to GoDaddy and I know for the email we use TLS to log in even for POP3 download and it is working, so I am not sure why python / Django option is not working. Can you please help?

I have called Godaddy, they cannot help because it is a software issue - all their settings and ports are working, so I have no one to ask.

Upvotes: 8

Views: 6572

Answers (6)

Vitor Machado
Vitor Machado

Reputation: 1

In my case, this way work for me:

#settings.py

EMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST='smtpout.secureserver.net'
EMAIL_PORT=465
EMAIL_USE_SSL=True
EMAIL_USE_TLS=False
EMAIL_HOST_USER='your@domain'
EMAIL_HOST_PASSWORD='yourpass'
ADMIN_EMAIL='your@domain'

Upvotes: 0

Vishnu Thuletiya
Vishnu Thuletiya

Reputation: 41

use 'smtpout.asia.secureserver.net' as EMAIL_HOST in Django settings.py. you can refer to the GoDaddy email help page link.

https://in.godaddy.com/help/mail-server-addresses-and-ports-for-business-email-24071

Upvotes: 1

zx_
zx_

Reputation: 41

It's been a while but, maybe the answer can help somebody else. I just talked to GoDaddy about the issue and the needed configration they told me was like,

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtpout.secureserver.net'
EMAIL_HOST_USER = env('EMAIL_HOST_USER')
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SERVER_EMAIL = EMAIL_HOST_USER
EMAIL_HOST_PASSWORD = env('EMAIL_HOST_PASSWORD')
EMAIL_PORT = 80
EMAIL_USE_SSL = False
EMAIL_USE_TLS = True

these are the django config settings but, I'm sure that it can be copied to other platforms.

Also, the email dns configration they provided was,

email dns config

Upvotes: 1

I managed to decide to access the site https://sso.secureserver.net/?app=emailsetup&realm=pass& It seems that when accessing, you can enable email for external use.

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtpout.secureserver.net'
EMAIL_HOST_USER='aXXXX@xxxx'
EMAIL_HOST_PASSWORD='AsgGSDAGSasdsagas'
DEFAULT_FROM_EMAIL='aXXXX@xxxx' 
EMAIL_PORT=465
EMAIL_USE_SSL=True 
EMAIL_USE_TLS=False

It worked for me

Upvotes: 1

Priyanka
Priyanka

Reputation: 127

I found this code worked for me.. Hope this will be useful to somebody.
I was using SMTP godaddy webmail..you can put this code into your django setting file.
Since you cannot set Both SSL and TSL together... if you do so you get the error something as, At one time either SSL or TSL can be true....

setting.py

# Emailing details
EMAIL_HOST = 'md-97.webhostbox.net'
EMAIL_HOST_USER = 'mailer@yourdomain'
EMAIL_HOST_PASSWORD = 'your login password'
EMAIL_PORT = 465
EMAIL_USE_SSL = True

Upvotes: 1

yoyoyoyo123
yoyoyoyo123

Reputation: 2472

This worked for me with my GoDaddy email. Since GoDaddy sets up your email in Office365, you can use smtp.office365.com.

settings.py

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.office365.com'
EMAIL_HOST_USER = '[email protected]'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
EMAIL_HOST_PASSWORD = 'myPassword'
EMAIL_PORT = 587
EMAIL_USE_SSL = False
EMAIL_USE_TLS = True

method in views.py that handles sending email. The email variable is from a user form.

from django.conf import settings
from django.core.mail import EmailMessage
def send_email(subject, body, email):
    try:
        email_msg = EmailMessage(subject, body, settings.EMAIL_HOST_USER, [settings.EMAIL_HOST_USER], reply_to=[email])
        email_msg.send()
        return "Message sent :)"
    except:
        return "Message failed, try again later :("

Upvotes: 9

Related Questions