I am using django-registration with default url-configurations. when I point to url mysite/accounts/register I am able to see the registration form but when I click submit button it keeps processing for some time and then returns "Page not found error". although If I try the same on development server at localhost it is working fine. I am checking e-mails at localhost by firing python's mail server. Here are settings for production server
ACCOUNT_ACTIVATION_DAYS = 7
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 465
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'myemail#gmail.com'
EMAIL_HOST_PASSWORD = 'mypassword'
DEFAULT_FROM_EMAIL = 'myemail#gmail.com'
LOGIN_REDIRECT_URL = '/'
and here are settings for development server at localhost
ACCOUNT_ACTIVATION_DAYS = 7
EMAIL_HOST = "localhost"
EMAIL_PORT = 1025
I am using default urls configuration,
url(r'^accounts/', include('registration.backends.default.urls')),
am I missing some configuration/settings? any help would be appreciated .
Related
During development, I have been using Gmail SMTP to send emails from my Django app. The Gmail settings are (settings.py):
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_HOST_USER = 'xxxx#gmail.com'
EMAIL_HOST_PASSWORD = 'xxxxxxxxx'
However, during production, I need to change to RoundCube webmail client to allow my project to use a custom email address that matches the domain name. I have tried the following settings and many others but none of them is working. I know this is simple, but this is my first project and I don't know whether there is something I am missing.
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'mydomain.com'
EMAIL_USE_TLS = True
EMAIL_PORT = 465
EMAIL_HOST_USER = 'accounts#mydomain.com'
EMAIL_HOST_PASSWORD = 'xxxxxxxxx'
I am trying to send activation and reset email in Django, but I am facing some challenges.
setting.py
EMAIL_BACKEND ='django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST ='smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS =True
EMAIL_HOST_USER ='email#gmail.com'
EMAIL_HOST_PASSWORD ='gmailpasword'
EMAIL_BACKEND ='django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = ‘mail.mysite.com’
DEFAULT_FROM_EMAIL = 'noreply#mysite.com'
EMAIL_HOST_USER = 'noreply#mysite.com'
EMAIL_HOST_PASSWORD = 'my pass'
EMAIL_USE_TLS = True
EMAIL_PORT = port
The first configuration is with Gmail which work fine in development but in production (shared Linux server) it does not work at all. The second configuration with an email I set up on
webmail (cPanel) which is not working in either development or production.
I just deploy a Django web app in Cpanel. But SMTP email is not working in Cpanel. It works only on my local machine. I don't have much knowledge about Cpanel.
Here is my code for setting.py:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_HOST_USER = 'my gmail'
EMAIL_HOST_PASSWORD = 'password'
solved!! changed EMAIL_HOST_USER to cpnael hosting email.
I tried to use https://protonmail.com email service for my django app to send notification emails. I googled and found that protonmail SMTPis 1026 and protonmail IMAP is 1143.
When I use gmail service it works fine.
My settings.py
EMAIL_HOST = 'smtp.protonmail.com'
EMAIL_HOST_USER = 'username#protonmail.com'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 1026
EMAIL_USE_TLS = True
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_FILE_PATH = os.path.join(BASE_DIR, 'apps', 'emails')
The ProtonMail Bridge says the email port should be 1025. I attached a screenshot of my SMTP settings.
How do you send email from Django using a hosted SMTP account (specially on Namecheap)?
I thought this would be straight forward, and simply a matter of filling out the standard EMAIL_* fields in my settings.py.
However, after entering my credentials in both my settings.py and Thunderbird, Thunderbird can download and send email, but Django times out with the error "SMTPServerDisconnected: Connection unexpectedly closed" when attempting to do the same.
My working settings in Thunderbird for my outgoing server (SMTP):
Server Name: oxmail.registrar-servers.com
Port: 465
User Name: myuser#mydomain.com
Authentication method: Normal password
Connection Security: SSL/TLS
My non-working settings in my Django settings.py:
EMAIL_HOST = 'oxmail.registrar-servers.com'
EMAIL_HOST_USER = 'myuser#mydomain.com'
EMAIL_HOST_PASSWORD = 'mypassword'
EMAIL_PORT = 465
EMAIL_USE_TLS = True
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
Aren't these settings identical? What am I doing wrong? Why does one work while the other fails?
Turns out the problem was that the default SMTP backend in Django does not support SSL, and my SMTP host required it (not just TLS). Fortunately, I found a dirt-simple SSL backend, added EMAIL_BACKEND = 'django_smtp_ssl.SSLEmailBackend' to my settings.py and everything just worked.
The settings below:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
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.