django-mailjet icon indicating copy to clipboard operation
django-mailjet copied to clipboard

No mails sent with django 1.10.1

Open jacopsd opened this issue 8 years ago • 7 comments

Filed following issue on the mailjet support channel (see below).

After some back and forth discussions, mailjet support concluded: "Django is not written by us, and it received an update Sept 9th on their github, at that time it stopped working. This is why you must consult Django's support in order to find out what they changed on their side for it to stop working."

So getting back here: did anyone face the same issue? Thank you for your help DJ


I want to send authentication and other mails from a django application using MailJet

SETUP: OSX 10.11.6 using django 1.10.1, python 2.7.10 On my domain, I have entered SPF & DKIM records. They are confirmed to be OK by MailJet status page. Package: django-mailjet=0.2.0

PROBLEM: When I test mailjet using curl from command line, it works fine, but when executing send_mail from python, no mail is sent. Nothing appears in the MailJet stats, but I do get a return value of '1' from the send_mail call:

(venv) Davy@Davys-iMac:~/SWE/gitrepos/django_swingit$ python manage.py shell Python 2.7.10 (default, Oct 23 2015, 19:19:21) [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole)

from django.core.mail import send_mail ret = send_mail( ... 'My Subject', ... 'Here is my DJTEST message.', ... '[email protected]', ... ['[email protected]','[email protected]'], ... fail_silently=False, ... ) print ret 1

jacopsd avatar Oct 28 '16 19:10 jacopsd

Did you fill the settings.py with your mailjet keys?

kidig avatar Oct 30 '16 09:10 kidig

Dear support

Yes, in the sense that the key is in an environment variable and settings.py contains:

EMAIL_USE_TLS = True EMAIL_BACKEND = 'django_mailjet.backends.MailjetBackend' MAILJET_API_KEY = 'f955caea0ef10ca2a5adcede42cee274' MAILJET_API_SECRET = os.environ['MAILJET_API_SECRET']

When I send a test mail, I do this: send_mail('my subject', 'my message', '[email protected]', ['[email protected]']) but nothing is received.

Note: I see also module “mailjet-rest 1.2.2” is installed. Is that required? Could it clash with with “django-mailjet 0.2.0”?

Thank you for your help.

Regards Davy

On 30 Oct 2016, at 10:42, DmitrII Gerasimenko [email protected] wrote:

Did you fill the settings.py with your mailjet keys?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kidig/django-mailjet/issues/4#issuecomment-257141407, or mute the thread https://github.com/notifications/unsubscribe-auth/AAM0XtpB_GnZnrESBuL309z8CnGx24Ntks5q5GabgaJpZM4KjwQB.

jacopsd avatar Oct 30 '16 11:10 jacopsd

Also, please check that your 'from_email' argument matched with one of emails in the Email addresses list - https://app.mailjet.com/account/sender.

And sure, the mailjet-rest package is required. It should be installed automatically with django-mailjet.

kidig avatar Oct 30 '16 13:10 kidig

Indeed, this is the case:

On 30 Oct 2016, at 14:03, DmitrII Gerasimenko [email protected] wrote:

Also, please check that your 'from_email' argument matched with one of email in the sender list - https://app.mailjet.com/account/sender https://app.mailjet.com/account/sender.

And sure, the mailjet-rest package is required. It should be installed automatically with django-mailjet.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kidig/django-mailjet/issues/4#issuecomment-257149769, or mute the thread https://github.com/notifications/unsubscribe-auth/AAM0XkO9G6Jj_ink0Al_FltKx2p1Zjnrks5q5JWEgaJpZM4KjwQB.

jacopsd avatar Oct 30 '16 20:10 jacopsd

Not an issue with Django. PR #3 should fix the issue. Would be nice to have a new release instead of using git to deploy.

xordoquy avatar Nov 29 '16 12:11 xordoquy

If this issue was fixed, can we close it?..

lorddaedra avatar Jun 09 '17 03:06 lorddaedra

same problem here

the only thing that's needed to fix it is the change on line #45 in that PR here https://github.com/kidig/django-mailjet/pull/3/files#diff-997f4ed88f1fea09dc499cd59763e7d2R45

without that, if you specify EmailMessage(to=['[email protected]']) then the mailjet backend tries to send 'Recipients': [{'Email': '', 'Name': '[email protected]'}] ...which goes nowhere

anentropic avatar Jun 29 '17 21:06 anentropic