how to enable SSL email in django? - django

I have in settings.py:
EMAIL_HOST = 'mail.myserver.pl'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'mymail#mail.myserver.pl'
EMAIL_HOST_PASSWORD = 'mypassword'
EMAIL_USE_TLS = False
But my server require SSL and I get AuthenticationError exception. How to enable SSL support in Django?

try this:
EMAIL_USE_SSL = True

Related

django, sendGrid not sending mail

I'm trying to send mail using SendGrid on django development server.
Here are my setting:
EMAIL_HOST = 'smtp.sendgrid.net'
DEFAULT_FROM_EMAIL = 'myemail#gmail.com'
EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_USE_SSL = False
EMAIL_HOST_USER = 'apikey'
EMAIL_HOST_PASSWORD = config('PASS')
and it is not working, it returns 1 on the terminal and nothing happens.

Django multiple SMTP accounts

Here are the Django simple SMTP backend settings for just 1 email account
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = "mail.mysmtpserver.somewhere"
EMAIL_PORT = 587
EMAIL_HOST_USER = "my#login"
EMAIL_HOST_PASSWORD = "mypassword"
EMAIL_USE_TLS = True
How is it possible to use 2 or more email accounts on the same server instead of one?
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = "mail.mysmtpserver.somewhere"
EMAIL_PORT =587
EMAIL_HOST_USER = "my#login2"
EMAIL_HOST_PASSWORD = "mypassword2"
EMAIL_USE_TLS = True
I just need to send different emails based on the subject by different email account.
I checked the Django documentation but there was nothing

Outlook office 365 mail SMTP email authentication doesn't work in django?

django settings config
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.office365.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'myemail#outlook.com'
EMAIL_HOST_PASSWORD = 'myPassword'
EMAIL_USE_TLS = True
EMAIL_USE_SSL = False
it shows error smtplib.SMTPAuthenticationError: (535, b'5.7.3 Authentication unsuccessful [BM1P287CA0013.INDP287.PROD.OUTLOOK.COM]')

django-registration sending activation and reset emails

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.

all-auth SMTPAuthentication Error

I'm getting SMTPAuthenticationError at /rest-auth/password/reset/ error.
I'm using all-auth-rest and set these on settings.py
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'randomemail#gmail.com'
EMAIL_PORT = 25 # or 587
EMAIL_HOST_PASSWORD = 'mypassword'
Also I enabled Displaying an Unlock Captcha and allowed less secure app access
What is missing?
Thanks
This configurations is if you work with smtp.gmail.com, other smtp is similiar with this configuration.
Unlock Captha: https://accounts.google.com/DisplayUnlockCaptcha
Change to active: https://www.google.com/settings/security/lesssecureapps
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'your_gmail#gmail.com'
EMAIL_HOST_PASSWORD = 'your_password'
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
I think you missed: EMAIL_BACKEND