kidig / django-mailjet

A Django email backend for use with Mailjet (un-official project)
MIT License
16 stars 13 forks source link

Fix dependency links #6

Closed lorddaedra closed 6 years ago

lorddaedra commented 7 years ago

Package should use official https://pypi.python.org/pypi/mailjet_rest

kidig commented 7 years ago

When you have to fix an official package several times, well, probably better to use your own fork :)

Have you test it now?

lorddaedra commented 7 years ago

Well, this issue with unstable official client better to fix by freezing versions (>=1.3,<1.4, for example) and via integrated CI system.

I will try to test this package with latest official client...

I see this changes:

  1. We lose this commit https://github.com/kidig/mailjet-apiv3-python/commit/bb52d9ed4bc18af3e3a4d5e38643b173e87468ce (just tests, not sure, we need it)
  2. Updated changes of official client https://github.com/mailjet/mailjet-apiv3-python/compare/8fcb63acaafde57d1cfe5ce6c0f2bc4d4a3ecc0d...master
lorddaedra commented 7 years ago

@kidig Okay, I tested:

I added

EMAIL_BACKEND = 'django_mailjet.backends.MailjetBackend'  # django.core.mail.backends.smtp.EmailBackend

MAILJET_API_KEY = os.environ.get('MAILJET_API_KEY')

MAILJET_API_SECRET = os.environ.get('MAILJET_API_SECRET')

to my settings.py

In docker-compose.yml I set values and

after that I run

➜  webpanel git:(feature/34-Mailjet) ✗ docker compose up -d db
➜  webpanel git:(feature/34-Mailjet) ✗ docker compose up web
...
In another terminal:

➜  webpanel git:(feature/34-Mailjet) ✗ docker exec webpanel_web_1 /usr/src/app/manage.py shell -c 'from django.core.mail import EmailMessage, EmailMultiAlternatives; msg = EmailMultiAlternatives("subject", "<html><body><b>body</b></body></html>", "email@mydomain.com", ["myemail@mydomain.com", ]); import pprint; pprint.pprint(msg); msg.send()'
<django.core.mail.message.EmailMultiAlternatives object at 0x7f0bbc2ceb38>
➜  webpanel git:(feature/34-Mailjet) ✗ docker exec webpanel_web_1 /usr/src/app/manage.py shell -c 'from django.core.mail import EmailMessage, EmailMultiAlternatives; msg = EmailMessage("subject", "<html><body><b>body</b></body></html>", "email@mydomain.com", ["myemail@mydomain.com", ]); import pprint; pprint.pprint(msg); msg.send()'

and it works... I've got messages as plaint text in my email...

But also I tried to send email during allauth user signup step. And it failed with strange error after I submit form: webpanel_web_1 exited with code 0

In Chrome I see:

This page isn’t working

127.0.0.1 didn’t send any data.
ERR_EMPTY_RESPONSE

It worked with SMTP settings...

lorddaedra commented 7 years ago

This bug is not related with official client version, I get same result with your stable version too...

Dev-server stop after sending form:

➜  webpanel git:(feature/34-Mailjet) ✗ docker-compose up web
webpanel_db_1 is up-to-date
Starting webpanel_web_1 ...
Starting webpanel_web_1 ... done
Attaching to webpanel_web_1
web_1  | Performing system checks...
web_1  |
web_1  | System check identified no issues (0 silenced).
web_1  | June 11, 2017 - 16:02:27
web_1  | Django version 1.11.2, using settings 'webpanel.settings'
web_1  | Starting development server at http://0.0.0.0:8000/
web_1  | Quit the server with CONTROL-C.
web_1  | [11/Jun/2017 16:02:59] "GET /accounts/signup/ HTTP/1.1" 200 14966
web_1  | [11/Jun/2017 16:02:59] "GET /static/pa/assets/vendor/font-awesome/css/font-awesome.css HTTP/1.1" 200 37414
web_1  | [11/Jun/2017 16:02:59] "GET /static/pa/assets/stylesheets/skins/default.css HTTP/1.1" 200 29928
web_1  | [11/Jun/2017 16:02:59] "GET /static/pa/assets/vendor/bootstrap/css/bootstrap.css HTTP/1.1" 200 146010
web_1  | [11/Jun/2017 16:02:59] "GET /static/pa/assets/vendor/magnific-popup/magnific-popup.css HTTP/1.1" 200 7302
web_1  | [11/Jun/2017 16:02:59] "GET /static/pa/assets/vendor/bootstrap-datepicker/css/bootstrap-datepicker3.css HTTP/1.1" 200 23495
web_1  | [11/Jun/2017 16:02:59] "GET /static/pa/assets/stylesheets/theme.css HTTP/1.1" 200 409524
web_1  | [11/Jun/2017 16:02:59] "GET /static/debug_toolbar/css/toolbar.css HTTP/1.1" 200 20322
web_1  | [11/Jun/2017 16:02:59] "GET /static/pa/assets/stylesheets/theme-custom.css HTTP/1.1" 200 43
web_1  | [11/Jun/2017 16:02:59] "GET /static/pa/assets/vendor/modernizr/modernizr.js HTTP/1.1" 200 19051
web_1  | [11/Jun/2017 16:02:59] "GET /static/pa/assets/vendor/jquery/jquery.js HTTP/1.1" 200 267194
web_1  | [11/Jun/2017 16:03:00] "GET /static/pa/assets/vendor/jquery-browser-mobile/jquery.browser.mobile.js HTTP/1.1" 200 2129
web_1  | [11/Jun/2017 16:03:00] "GET /static/pa/assets/vendor/nanoscroller/nanoscroller.js HTTP/1.1" 200 10394
web_1  | [11/Jun/2017 16:03:00] "GET /static/pa/assets/vendor/bootstrap/js/bootstrap.js HTTP/1.1" 200 69707
web_1  | [11/Jun/2017 16:03:00] "GET /static/pa/assets/vendor/magnific-popup/jquery.magnific-popup.js HTTP/1.1" 200 43589
web_1  | [11/Jun/2017 16:03:00] "GET /static/pa/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff2?v=4.7.0 HTTP/1.1" 200 77160
web_1  | [11/Jun/2017 16:03:00] "GET /static/pa/assets/vendor/bootstrap-datepicker/js/bootstrap-datepicker.js HTTP/1.1" 200 60797
web_1  | [11/Jun/2017 16:03:00] "GET /static/pa/assets/images/logo.png HTTP/1.1" 200 6696
web_1  | [11/Jun/2017 16:03:00] "GET /static/pa/assets/vendor/bootstrap/css/bootstrap.css.map HTTP/1.1" 200 389287
web_1  | [11/Jun/2017 16:03:00] "GET /static/pa/assets/vendor/bootstrap-datepicker/css/bootstrap-datepicker3.css.map HTTP/1.1" 200 23719
web_1  | [11/Jun/2017 16:03:00] "GET /static/pa/assets/vendor/jquery-placeholder/jquery-placeholder.js HTTP/1.1" 200 9724
web_1  | [11/Jun/2017 16:03:00] "GET /static/pa/assets/javascripts/theme.js HTTP/1.1" 200 112659
web_1  | [11/Jun/2017 16:03:00] "GET /static/pa/assets/javascripts/theme.custom.js HTTP/1.1" 200 41
web_1  | [11/Jun/2017 16:03:00] "GET /static/debug_toolbar/js/jquery_pre.js HTTP/1.1" 200 136
web_1  | [11/Jun/2017 16:03:01] "GET /static/debug_toolbar/js/jquery_post.js HTTP/1.1" 200 118
web_1  | [11/Jun/2017 16:03:01] "GET /static/debug_toolbar/js/toolbar.js HTTP/1.1" 200 12552
web_1  | [11/Jun/2017 16:03:01] "GET /static/debug_toolbar/img/ajax-loader.gif HTTP/1.1" 200 404
web_1  | [11/Jun/2017 16:03:01] "GET /static/pa/assets/javascripts/theme.init.js HTTP/1.1" 200 12419
web_1  | [11/Jun/2017 16:03:01] "GET /static/pa/assets/vendor/nanoscroller/jquery.nanoscroller.min.js.map HTTP/1.1" 200 34751
web_1  | [11/Jun/2017 16:03:01] "GET /static/debug_toolbar/css/print.css HTTP/1.1" 200 29
webpanel_web_1 exited with code 0
➜  webpanel git:(feature/34-Mailjet) ✗
lorddaedra commented 7 years ago

@kidig I added version range for official client. So in same time we can get latest versions of official client and make sure, it's stable because of we manually limit versions via >= and <