MailgunAPIError<Response [400]> with django-registration-redux - django

I'm trying to send registration emails by django-registration-redux,
but got this response code: MailgunAPIError Response [400].
The code means 'Bad Request - Often missing a required parameter'
But i can send an email manually on my site, it's functional.
Am I missed some required parameter between registration-redux and mailgun?
This is my setting:
INSTALLED_APPS = (...,
'registration' ,
)
ACCOUNT_ACTIVATION_DAYS = 7
EMAIL_BACKEND = 'django_mailgun.MailgunBackend'
MAILGUN_ACCESS_KEY = 'xxxx'
MAILGUN_SERVER_NAME = 'xxxx'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.mailgun.org'
EMAIL_HOST_USER='postmaster#xxxx'
EMAIL_HOST_PASSWORD= 'xxxx'
EMAIL_PORT = 587
And this is my urls setting
path('accounts/', include('registration.backends.default.urls')

I solved the problem by myself.
I changed the EMAIL_BACKEND from 'django_mailgun.MailgunBackend' to 'django.core.mail.backends.smtp.EmailBackend' and it's OK.

Related

how do I configure my Django app to use Dreamhost email?

I created a django app that has a contact form where users can send an email to the company (The email configured in the APP)
I am getting "SERVER ERROR 500"
After reading this:
django email settings on dreamhost
I tried the following format in my settings.py:
EMAIL_HOST = 'smtp.dreamhost.com' # I also tried pop.dreamhost.com / imap.dreamhost.com with their respective port numbers.
EMAIL_USE_TLS = True # I also tried EMAIL_USE_SSL
EMAIL_PORT = 587 # I also tried 25 and 465
EMAIL_HOST_PASSWORD = 'EMAIL_PASSWORD' # also tried SERVER_PASSWORD
EMAIL_HOST_USER = 'my_dreamhost_email' # Also tried admin#mydomain.com
EMAIL_SUBJECT_PREFIX = ''
SERVER_EMAIL = 'my_dreamhost_email' # also tried 'localhost' / 'admin#mydomain.com'
ADMINS = (('Jack Shedd', 'jack#example.com'),) # I used my details
PS: The app is working perfectly if I use gmail
What are the correct details to use?
Some thoughts about that:
Change your settings.py:
DEBUG = False
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
ADMIN_EMAIL = 'Dont reply <no-reply#your_dreamhost_email.com>'
SUPPORT_EMAIL = 'Dont reply <no-reply#your_dreamhost_email.com>'
DEFAULT_FROM_EMAIL = ADMIN_EMAIL
SERVER_EMAIL = ADMIN_EMAIL

How can I get Django to send error emails on status codes above 500?

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.

Django / Sending email with Mail Service Prodiver like Mailjet

I have installed django-anymail
My SPF and DKIM are configured in my ISP
Here is my settings.py :
EMAIL_BACKEND = "anymail.backends.mailjet.EmailBackend"
ANYMAIL = {
"MAILJET_API_KEY": os.getenv('MYAPP_MAILJET_API_KEY'),
"MAILJET_SECRET_KEY": os.getenv('MYAPP_MAILJET_API_SECRET'),
}
EMAIL_HOST = 'in-v3.mailjet.com'
EMAIL_HOST_USER = '????'
EMAIL_HOST_PASSWORD = '????'
EMAIL_HOST_PORT = 587
Views.py
send_mail('contact form','click',mail1,[mail2],fail_silently=False)
I got confused for
EMAIL_HOST_USER and EMAIL_HOST_PASSWORD
As I want to use mailjet, is it necessary ? Also is send_mail the right function in this case ?

django: sending mails in two different ways [duplicate]

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.. :)

Pinax-theme-bootstrap editing

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?