Commit Graph

691 Commits

Author SHA1 Message Date
jc-ee
2a36da54e6 Postmark: Fix sending templated email to a single recipient
Fix a bug where sending an email with a template_id and a single to address
would cause a Postmark API error.

Thanks @jc-ee for finding and fixing.
2020-04-13 13:48:37 -07:00
Mike Edmunds
920d8dd70f SendGrid: Fix multiple recipients with only merge_global_data
In SendGrid backend, support non-batch template send to multiple
recipients when `merge_global_data` is set without `merge_data`.
Regression introduced in v6.0.

Fixes #179
2020-03-18 17:08:10 -04:00
sebashwa
4245d468ec Docs: SendinBlue templates now support attachments
Attachments now work with SendinBlue templates as long as you are using their new template language (which Anymail has required since v7).

https://developers.sendinblue.com/changelog/send-attachment-with-template-through-apiv3

Existing code works. Just remove documentation that warned of their previous limitation.
2020-02-28 10:44:11 -08:00
Mike Edmunds
0c66e1eed9 Docs: document DEBUG_API_REQUESTS setting
(And add a system check to warn about its use in production deployment.)
2019-12-15 14:23:03 -08:00
Mike Edmunds
95080bfeb9 SendGrid: document text attachment charset bug
Document SendGrid's unpredictable behavior around forcing `charset="iso-8859-1"` into text attachments. (Since it seems to be happening again.)

See #150 for details.
2019-12-13 12:49:00 -08:00
Mike Edmunds
59685b82e1 Tests: work around Mailgun event reporting change
In the live integration tests, work around Mailgun's recent change
to how inline attachments are reported in "accepted" events data.

(But keep it working either way, since it seems likely this change was
unintentional—other event types still exclude inline attachments from
`event.message.attachments`.)

Fixes #172
2019-12-11 14:53:25 -08:00
medmunds
c38218dba1 Tests: Update for Django 3.0 release 2019-12-02 10:49:12 -08:00
A Lee
1fc44a4e15 Docs: fix typos and other minor text edits
- remove extraneous parens
- a few minor suggested text edits for readability
2019-10-15 14:40:17 -07:00
Mike Edmunds
acca6a46e1 Docs: Clarify that Postmark supports merge_data
Fix outdated info in ESP summary table.

Fixes #168.
2019-10-07 12:22:17 -07:00
medmunds
2ff088df71 Tests: fix Travis pypy versioning
One more try.
2019-09-27 18:21:36 -07:00
medmunds
484dd8b505 Tests: let Travis pick the specific pypy builds 2019-09-27 13:03:30 -07:00
medmunds
3167a74d35 Upgrade dev tooling
(Drop detox, which is built into tox 3.7 and later.)
2019-09-27 11:54:40 -07:00
medmunds
c6ab1e374c Tests: add Django 3.0 alpha, Python 3.8-dev 2019-09-27 10:58:35 -07:00
medmunds
2762ea9ff8 Docs: fix broken intersphinx mapping for requests
The requests docs may be moving, and redirects are currently broken.
Load the intersphinx inventory from a (currently) working temporary
location.
2019-09-26 19:25:20 -07:00
Mike Edmunds
0c37cd4b5f Release 7.0 2019-09-07 13:22:44 -07:00
Mike Edmunds
0a8887913c SendinBlue: additional template/tags improvements
Additional changes related to SendinBlue improvements in #158:

* Support multiple tags in webhooks (closes #162)
* Remove additional outdated template code in backend
* Update integration tests
* Update docs and changelog; note breaking changes as discussed in #161
2019-09-04 15:45:08 -07:00
Mike Edmunds
fd558e904e Mailgun: disable non-ASCII attachment filename workaround when not needed
urllib3 v1.25 fixes non-ASCII filenames in multipart form data to be
RFC 5758 compliant by default, so our earlier workaround is no longer
needed. Disable the workaround if we detect that Requests is using a
fixed version of urllib3.

Closes #157
2019-09-03 18:04:27 -07:00
Mike Edmunds
df29ee2da6 Mailgun: make merge_data work with stored handlebars templates
Mailgun has two different template mechanisms and two different ways
of providing substitution variables to them. Update Anymail's
normalized merge_data handling to work with either (while preserving
existing batch send and metadata capabilities that also use Mailgun's
custom data and recipient variables parameters).

Completes work started by @anstosa in #156.
Closes #155.
2019-09-03 11:51:19 -07:00
medmunds
8143b76041 Sendinblue: remove attachment from template integration test
Newer send API doesn't allow attachments with templates.
See discussion in #158
2019-08-30 13:24:43 -07:00
Thorben Luepkes
989d56bd85 Sendinblue: use latest API improvements (templates, tags)
Track Sendinblue API updates:
* Multiple tags are now supported
* When using a template, display name is now supported on 'to', 'bcc', 'cc' and 'replyTo'
* Templates now support overriding 'from_email' and 'subject'
* Templates no longer require separate API endpoint
* 'merge_global_data' can be used without templates
2019-08-28 18:52:11 -07:00
Ansel Santosa
73a73ea01f Mailgun: Support stored templates
Add support for Mailgun's new template option

Fixes #155
2019-07-30 10:50:42 -07:00
medmunds
df3d577b41 Release 6.1 2019-07-07 16:20:22 -07:00
medmunds
181d5886eb Add MAILGUN_WEBHOOK_SIGNING_KEY setting.
Fixes #153.
2019-07-07 13:43:08 -07:00
medmunds
fe6ee5bf84 Release 6.0.1 2019-05-19 11:30:28 -07:00
medmunds
5dce0895f1 Fix UnicodeEncodeError error while reporting invalid email address.
Fixes #148.
2019-05-19 11:19:21 -07:00
medmunds
44518ed69f Update tests, CI, readme for Django 2.2 release.
(Earlier Anymail releases work fine with Django 2.2, and have been
tested against it; this just makes everything official.)

Prefer Python 3.7 and Django 2.2 for "extra" tests (live integration,
optional packages, Django master).
2019-05-08 13:29:56 -07:00
medmunds
ebb6b041e7 Support using AnymailMessage with django-mailer
Make UNSET preserve its identity across pickling. (Also make its repr
mention "unset", to simplify interpretting stack traces.)

Fixes #147.
2019-05-08 13:16:01 -07:00
medmunds
4c443f5515 Release 6.0 2019-02-23 16:28:15 -08:00
medmunds
dabbdad3bd Properly encode path components used to construct API URLs
Resolves #144 and similar potential issues
2019-02-23 15:27:41 -08:00
medmunds
578bad9a57 SendGrid: generate unique message_id for each batch recipient
Closes #139
2019-02-23 15:01:54 -08:00
medmunds
d2d568b6d3 SendGrid: simplify personalizations processing; stop using "sections"
* Rework and simplify personalizations code (that had grown convoluted
  through several feature additions).

* Stop putting merge_global_data in legacy template "sections"; instead
  just merge it into individual personalization substitutions like we
  do for dynamic templates. (The "sections" version didn't add any
  functionality, had the potential for conflicts with the user's own
  template section tags, and was needlessly complex.)
2019-02-23 14:07:01 -08:00
medmunds
f89d92bc37 Tests: avoid pummeling httpbin.org
Tag RequestsBackendLiveTestCase as 'live' so it only runs in a couple
of Travis builds (rather than all 20+ of them).
2019-02-23 13:49:00 -08:00
Mike Edmunds
75d7671056 Add merge_metadata for other ESPs
Support merge_metadata in Mailgun, Mailjet, Mandrill, Postmark, 
SparkPost, and Test backends. (SendGrid covered in earlier PR.)

Also:
* Add `merge_metadata` to AnymailMessage, AnymailMessageMixin
* Add `is_batch()` logic to BasePayload, for consistent handling
* Docs

Note: Mailjet implementation switches *all* batch sending from their 
"Recipients" field to to the "Messages" array bulk sending option.
This allows an independent payload for each batch recipient.
In addition to supporting merge_metadata, this also removes the
prior limitation on mixing Cc/Bcc with merge_data.

Closes #141.
2019-02-23 13:32:28 -08:00
Janne Thoft
85dce5fd6a SendGrid: add merge_metadata
Add support in SendGrid backend for per-recipient metadata.
2019-02-21 12:44:53 -08:00
medmunds
412a1b78c6 Mailgun: Better error message for invalid sender domains
Try to catch cases where Mailgun will return HTTP 200-OK with the
text "Mailgun Magnificent API" rather than sending the email.

See #144.
2019-02-19 17:42:06 -08:00
medmunds
a283def798 Travis: only need to avoid tox==3.7.0
tox 3.7.1 (or whatever's next) will fix the issue described in 976bca1.
2019-02-19 17:30:45 -08:00
medmunds
e91d95a41e Suggest including settings and code in GitHub issue template 2019-02-19 17:23:23 -08:00
medmunds
acd3ca00c8 Improve ESP response formatting in error messages 2019-02-19 17:22:01 -08:00
Mike Edmunds
978996d7b8 Test without optional packages
Tox:
* Add Tox factor for extras (all, none, individual ESP).
  For now, only break out ESPs that have specific extra
  dependencies (amazon_ses, sparkpost).
* Install most package dependencies (including extras)
  through the package itself.
* Use new runtests.py environment vars to limit test tags
  when Tox isn't installing all extras.

Travis:
* Rework matrix to request specific TOXENVs directly;
  drop tox-travis.

Test runner (runtests.py):
* Centralize RUN_LIVE_TESTS logic in runtests.py
* Add ANYMAIL_ONLY_TEST and ANYMAIL_SKIP_TESTS env vars
  (comma-separated lists of tags)

Test implementations:
* Tag all ESP-specific tests with ESP
* Tag live tests with "live"
* Don't import ESP-specific packages at test module level. 
  (Test discovery imports test modules before tag-based filtering.)

Closes #104
2019-02-09 15:04:08 -08:00
medmunds
653fdac3cc Tests: Add django22-pypy3 to tox environments
Fixes #140
2019-02-08 12:28:59 -08:00
medmunds
bd55d8c298 Rework editorconfig
* Most file types prefer 2-space indents, so now default
  to that and list the exceptions
* Add max_line_length=120 for .py files (Django convention)
* Bat files require CRLF
2019-02-08 12:05:57 -08:00
medmunds
8464d3a231 Docs: note SERVER_EMAIL setting default won't work with most ESPs
mail_admins, mail_managers, and similar Django error reporting
generally won't work with the default SERVER_EMAIL setting
root@localhost.
2019-02-08 11:37:15 -08:00
medmunds
7b58d87079 Docs: Show code cross-reference links as clickable (blue) 2019-02-05 11:34:51 -08:00
medmunds
f64e98141a Postmark: don't error on Cc/Bcc-only send; preserve recipient caps
Postmark docs notwithstanding, Postmark allows sending mail without a
To field, as long as there is some recipient in Cc or Bcc. The API
response has a slightly different shape in this case, and Anymail now
handles that.

Also updates related recipient status parsing. Previously, Anymail's
Postmark backend converted all recipient emails to lowercase for status
reporting, and omitted Cc or Bcc recipients from
`message.anymail_status.recipients[email]`. Now, the backend preserves
the case of each recipient email as originally sent, and includes Cc
and Bcc status.

Because client code may have been relying on lowercasing recipient
emails to check status, this is a potentially breaking change.

Fixes #135
2019-02-05 11:08:26 -08:00
medmunds
c5c015e9a1 Internal: add CaseInsensitiveCasePreservingDict
Like CaseInsensitiveDict (which we borrow from Requests), but preserves
case of the first key set rather than the last.
2019-02-05 11:01:55 -08:00
medmunds
3013eaf24b Travis: Xenial pypy currently requires explicit versions
"At the moment" Travis Xenial environment can't resolve
`python=pypy` or `python=pypy3` unless you include the specific
pypy version number.

https://travis-ci.community/t/pypy-2-7-on-xenial/889/4
https://travis-ci.community/t/pypy-2-7-on-xenial/889/5
2019-01-17 11:27:40 -08:00
medmunds
f1fedfcfeb Travis: switch to Xenial build environment
(Allows testing Python 3.7 without using sudo.)
2019-01-17 11:15:44 -08:00
medmunds
a35ba9395d Tox/Travis: enable Django 2.2alpha testing 2019-01-17 11:14:01 -08:00
medmunds
4ee4b335a2 Release 5.0 2018-11-07 09:46:48 -08:00
medmunds
10f6f3f821 Postmark: Support both TemplateAlias and TemplateId as template_id
Accept either Postmark's template alias or numeric id for `template_id`.
2018-11-06 18:39:49 -08:00