I am trying to set up Django-Userena.
I have added the following line to settings.py file:
EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
Also tried with:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
When trying to sign up for a new account, I get this error:
ImproperlyConfigured at /accounts/signup/
Module "django.core.mail.backends.smtp" does not define a "EmailBackEnd" class
I am pretty sure it's something obvious, but at this point, I can't figure out the problem.
Any help is much appreciated.
Try with following gmail settings in settings.py
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'your-username#gmail.com'
EMAIL_HOST_PASSWORD = 'your-password'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
Make sure the above entries should be in your settings file
If you have your own mail server then first install sendmail
Instead of using smtp.gmail.com which imposes lot many limitations, you can have your own mail server.
you can do it by installing your own mailserver:
sudo apt-get install sendmail
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = "mail.mysmtpserver.somewhere"
#EMAIL_PORT = ""
EMAIL_HOST_USER = "my#login"
EMAIL_HOST_PASSWORD = "mypassword"
#EMAIL_USE_TLS = True
Add DEFAULT_FROM_EMAIL = 'your#mail.com' to your settings and it should work.
Related
I have migrated an old codebase to a new server and am now running Django 4.0.5.
I can send emails from the shell as follows:
from django.core.mail import mail_admins
mail_admins(subject='test', message='test')
But I don't receive any emails on 500 or higher errors.
My settings are:
DEBUG = env('DEBUG')
ADMINS = [('My Name', 'me#provider.com'),]
MANAGERS = ADMINS
ADMIN_EMAIL = ['me#provider.com',]
DEFAULT_FROM_EMAIL = 'admin#provider.com'
SERVER_EMAIL = 'admin#provider.com'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'admin#provider.com'
EMAIL_HOST_PASSWORD = env('EMAIL_HOST_PASSWORD')
EMAIL_USE_TLS = True
And i have tried adding:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
But they are still not sent.
I am using django-environ, but debug is set to false.
Any ideas what the problem could be?
Have you checked this?
may be the problem is this.
https://support.google.com/accounts/answer/6010255?hl=en#:~:text=To%20help%20keep,continue%20to%20read.
I have a problem with the settings file
I try to configure the sending of mail but it not works
I wrote :
EMAIL_HOST= 'mailhost.onera'
EMAIL_HOST_USER = 'patrice.kerviel#onera.fr'
EMAIL_HOST_PASSWORD = 'my-password'
EMAIL_PORT = 25
EMAIL_USE_TLS = True
and i have the error:
STARTTLS extension not supported by the server
if i change :
EMAIL_USE_TLS = False
I have the error :
AUTH extension not supported by the server
if I change :
EMAIL_HOST_USER = None
EMAIL_HOST_PASSWORD = None
EMAIL_PORT = 25
EMAIL_USE_TLS = False
Now, I have no error but no email is sent
what is this problem ?
I preferebly use mandrilapp.com, it is of almost free.Just signup and get API Key in settings.In order to integrate to django, use djrill .Simple steps
pip install djrill
In INSTALLED_APPS
INSTALLED_APPS = (
...
"djrill"
)
In settings.py
MANDRILL_API_KEY = "****frtyy*******"
EMAIL_BACKEND = "djrill.mail.backends.djrill.DjrillBackend"
Then use django.core.email methods(send_mail, etc...).No formalities..Enjoy.. :)
I'm looking at https://docs.djangoproject.com/en/dev/topics/email/
My question is, is there way I can use smtp.google.com without authentication or without having to put my auth information into settings.py or as a parameter in the django.core.mail.send_mail function?
At this point I'm looking for best practices for using smtp.google.com on django, I understand there are better solutions such as http://sendgrid.com/
You cannot use smpt.gmail.com without providing your auth_information i.e your gmail password.
However you can put your auth information in a local_settings.py and do not add this local_settings in version control so no one except you would see this file. Include this local_settings in your settings.py.
settings.py
...
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
...
...
from local_settings import *
local_settings.py
EMAIL_HOST_USER = 'user#gmail.com'
EMAIL_HOST_PASSWORD = 'yourpassword'
try including this in settings.py:
# Email configuration.
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'user#domain.com'
EMAIL_HOST_PASSWORD = 'yourpassword'
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'user#domain.com'
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
If you have a web domain provider (like namecheap, godady, etc) you can associate you domain (mycompany.com) with Gmail. For that feature ask help in your domain provider or look info in Internet:
http://www.namecheap.com/support/knowledgebase/article.aspx/1244/78/
http://help.squarespace.com/customer/portal/articles/581494-how-do-i-set-up-google-apps-for-my-domain-
Hope it helps,
cheers.
Pinax theme for Bootstrap on Django twitter lacks a clear guide. Like how it's supposed to send emails when you haven't specified the email_host and password. Changing the top bar to include other links like Home Contact etc.
I've tried to find the pages, other bootstrap themes from bootwatch also don't take effect. How do you change it?
Email settings will be the same as django's
Example:-
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# Host for sending e-mail.
EMAIL_HOST = 'localhost'
# Port for sending e-mail.
EMAIL_PORT = 1025
# Optional SMTP authentication information for EMAIL_HOST.
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False
Or if you are using a remote mail server, something like this:-
EMAILS_ALLOWED = True
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'no-replymysite.com'
EMAIL_HOST_PASSWORD = 'myspecialpass'
EMAIL_PORT = 587
EMAIL_SUBJECT_PREFIX = '[MySite.com]'
DEFAULT_FROM_EMAIL = 'MySite.com Auto Notification <no-reply#mysite.com>'
Regarding the 2nd question about changing the theme/look-and-feel, I have responded to a similar question here, just yesterday - How to change the pinax(0.9a2) template?
I am deploying a Django app on Heroku, and using the Sendgrid addon to send out validation email when a user registers on the site.
I followed the instructions here and pasted the following into settings.py:
EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_HOST_USER = 'sendgrid_username'
EMAIL_HOST_PASSWORD = 'sendgrid_password'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
However, my app is crashing after registration.
What exactly am I supposed to put for EMAIL_HOST_USER and EMAIL_HOST_PASSWORD?
Under the developer's tab in the sendgrid addon in heroku, it gives me the username app*******#heroku.com, and for password it just says "Your Password". Is the password my Heroku password?
Also, do I need to include DEFAULT_FROM_EMAIL in my settings.py file? And where do I tell Sendgrid what it is?
EDIT: I've set DEBUG = True, and it looks like the error is:
SMTPSenderRefused
(550, 'Cannot receive from specified address <info#myapp.com>: Unauthenticated senders not allowed', 'info#myapp.com')
it looks like the problem is happening before Sendgrid does its thing. Do I need to authenticate the email address with Heroku somehow?
Within your settings.py include:
import os
EMAIL_HOST_USER = os.environ['SENDGRID_USERNAME']
EMAIL_HOST= 'smtp.sendgrid.net'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_PASSWORD = os.environ['SENDGRID_PASSWORD']
Edit: changed EMAIL_PASSWORD to EMAIL_HOST_PASSWORD as that's the correct spelling.
In the intervening 10 years, the above answer has become obsolete. Sendgrid now uses an API key.
https://docs.sendgrid.com/for-developers/sending-email/django
SENDGRID_API_KEY = os.getenv('SENDGRID_API_KEY')
EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_HOST_USER = 'apikey' # this is exactly the value 'apikey'
EMAIL_HOST_PASSWORD = SENDGRID_API_KEY
EMAIL_PORT = 587
EMAIL_USE_TLS = True