Commit Graph

232 Commits

Author SHA1 Message Date
Mike Edmunds
faf98c22d7 MailerSend: support extra headers
MailerSend added a `"headers"` API field
(which is available to "Enterprise
accounts only").
2024-06-21 17:41:33 -07:00
Mike Edmunds
0776b12331 Feature: Implement merge_headers
Implement and document `merge_headers`
for all other ESPs that can support it. (See #371
for base and Amazon SES implementation.)

Closes #374
2024-06-20 15:31:58 -07:00
Vitaliy
6e696b8566 SendGrid: report dropped "Bounced Address" webhook events as reason "bounced"
In SendGrid tracking webhook, handle event="dropped", reason="Bounced Address" 
events as type "dropped", reject_reason "bounced" (rather than reject_reason "other").

See https://www.twilio.com/docs/sendgrid/for-developers/tracking-events/event#dropped
2024-06-20 14:42:25 -07:00
Mike Edmunds
0f2eef7300 Amazon SES: support headers with template
Use new SES v2 SendBulkEmail ReplacementHeaders param
to support features that require custom headers,
including `extra_headers`, `metadata`,
`merge_metadata` and `tags`.

Update integration tests and docs

Closes #375
2024-06-08 13:29:09 -07:00
Mike Edmunds
d6c108c027 Tests: test with Django 5.1 prerelease 2024-05-22 11:16:01 -07:00
Rodrigo Nicolas Carreras
33f680686b Add merge_headers option for Amazon SES
Add new `merge_headers` message option 
for per-recipient headers with template sends. 

* Support in base backend
* Implement in Amazon SES backend
  (Requires boto3 >= 1.34.98.)

---------

Co-authored-by: Mike Edmunds <medmunds@gmail.com>
2024-05-21 11:55:29 -07:00
Mike Edmunds
4c62f7bee0 Tests: fix broken inbound test
Django SafeMIMEText corner case
behaves differently in Python
3.11.9+, 3.12.3+, likely due to
https://github.com/python/cpython/pull/116125
2024-05-16 11:39:48 -07:00
Mike Edmunds
abb984485b Amazon SES: remove deprecated v1 support
- Remove deprecated amazon_sesv1 EmailBackend
- Remove deprecated amazon_sesv2 alias
  for amazon_ses EmailBackend
- Update docs
2024-03-12 13:38:45 -07:00
Mike Edmunds
948ab2be27 Brevo: SendinBlue compatibility
(See previous commit.)

- Maintain deprecated compatibility
  versions on the old names/URLs.
  (Split into separate commit
  to make renamed files more
  obvious.)
2024-03-11 18:51:39 -07:00
Mike Edmunds
c7ee59c3ca Brevo: Rename SendinBlue to Brevo
- Replace "SendinBlue" with "Brevo"
  throughout the code.
- Maintain deprecated compatibility
  versions on the old names/URLs.
  (Split into separate commit
  to make renamed files more
  obvious.)
- Update docs to reflect change,
  provide migration advice.
- Update integration workflow.
2024-03-11 18:46:52 -07:00
Mike Edmunds
14d451659e Unisender Go: fix integration test
test+bcc2@... is a sink address;
bcc2@... is not (and gets rejected)
2024-03-06 17:10:36 -08:00
David Jean Louis
5949069321 Mailgun: fix webhook error with null delivery-status
Mailgun now sometimes posts `"delivery-status": null` 
in the tracking event payload. Avoid raising an AttributeError
when that occurs.

Fixes #361
2024-03-05 13:58:41 -08:00
Arondit
a71a0d9af8 Unisender Go: new ESP
Add support for Unisender Go

---------

Co-authored-by: Mike Edmunds <medmunds@gmail.com>
2024-03-05 11:38:40 -08:00
Mike Edmunds
706fce60ac Resend: support batch send
Add support for `merge_metadata`
and new Resend email/batch API.
2024-02-19 16:41:22 -08:00
Mike Edmunds
4f305131ee Brevo: add batch send support
Closes #353
2024-02-19 11:52:10 -08:00
Mike Edmunds
804cb76aa1 Docs: Update Brevo opened event
Brevo has stopped sending the opened
event on first open (along with the
unique_opened event), so change docs
to recommend enabling both.
2023-12-29 11:28:40 -08:00
Mike Edmunds
2cadb949cd Resend: disable bad-auth integration test
Resend's API no longer returns 403
responses for bad API keys (or 401
for missing auth header). Now, it just
never responds, leading to a TimeoutError.

Since this seems likely to be a Resend
bug, just disable the bad API key
integration test for now.

(Resend changed behavior sometime between
2023-12-07 and 2023-12-14, from our
scheduled integration test runs.)
2023-12-29 11:28:40 -08:00
Mike Edmunds
b5ef492466 Resend: new ESP (#341)
Add support for Resend.com backend and webhooks.

Closes #341
2023-10-25 12:23:57 -07:00
Mike Edmunds
823a161927 Fix global SEND_DEFAULTS merging
Replace generic `combine` with
specific `merge_dicts_deep`,
`merge_dicts_shallow`,
`merge_dicts_one_level` or
`concat_lists`, depending on
appropriate behavior for each
message attribute.

Fixes merging global `SEND_DEFAULTS`
with message `esp_extra` for ESP APIs
that use nested payload structures.
And clarifies intent for other properties.
2023-10-19 14:33:50 -07:00
Mike Edmunds
05afde0651 SendGrid: support multiple reply_to
Closes #325
2023-07-27 18:37:31 -07:00
Mike Edmunds
c8a5e13c89 Brevo: add inbound support
(Also adds "responses" to test requirements,
for mocking fetches of Brevo inbound
attachments.)

Closes #322
2023-07-27 18:26:57 -07:00
Léo Martinez
0ac248254e Inbound: improve inline content handling
* refactor: derive `AnymailInboundMessage` from `email.message.EmailMessage`
  rather than legacy Python 2.7 `email.message.Message`

* feat(inbound): replace confusing `inline_attachments` with `content_id_map`
  and `inlines`; rename `is_inline_attachment` to `is_inline`; deprecate old names 

Closes #328

---------

Co-authored-by: Mike Edmunds <medmunds@gmail.com>
2023-07-27 15:10:58 -07:00
Mike Edmunds
bc8ef9af0f Tests: update Postmark integration
Postmark has changed their error message
for invalid server token. (Also, we don't
care about the specific error code, just
that the error is caught and reported.)
2023-06-27 12:25:13 -07:00
Mike Edmunds
4f4461af4d Tests: update Mandrill integration
Mandrill has changed status code for
invalid from_email from 500 to 400.
(We don't actually care about the specific
code, just that the error is caught and
reported.)
2023-06-27 12:23:35 -07:00
sblondon
8a72f89e8a Sendinblue: rename to Brevo
* Update docs to (usually) refer to Brevo rather than Sendinblue
* Change SENDINBLUE_API_URL to api.brevo.com
   (same API is available on both domains)
* Leave code references (settings, backend name, webhook urls)
   unchanged as `sendinblue`, to avoid unnecessary client changes
2023-06-13 13:04:52 -07:00
Mike Edmunds
744d467f70 Postmark inbound: improve inbound parsing
- Support Postmark's RawEmail option;
  recommend it in docs
- Handle Bcc when provided by Postmark
- Obtain `envelope_sender` from Return-Path info
  Postmark now adds, rather than parsing Received-SPF

Related:
- Add `AnymailInboundMessage.bcc` convenience prop
- Test against full Postmark "check" inbound payloads
  (which don't match their docs or real inbound payloads)
- Don't warn about receiving "check" payload
2023-05-06 11:40:00 -07:00
Mike Edmunds
746cf0e24e Mandrill: drop Djrill compatibility 2023-05-04 13:08:05 -07:00
Mike Edmunds
41754d9813 Amazon SES: use SES v2 API by default
- Rename `anymail.backends.amazon_sesv2.EmailBackend`
  to `amazon_ses`, making SES v2 the default.
- Rename the old `amazon_ses` backend to `amazon_sesv1`,
  keeping it available. Add a deprecation warning.
- Alias `amazon_sesv2` to `amazon_ses`, with a
  deprecation warning (for projects that opted
  into v2 early under Anymail 9.1 or 9.2).
- Similar renaming on the test files.
- Update docs to assume v2 in most places
  (other than migration-specific sections)
2023-05-04 12:27:55 -07:00
Mike Edmunds
e8df0ec8e0 Modernize packaging
Switch to pyproject.toml packaging, using hatchling.

- Replace all uses of setup.py with updated equivalent
- BREAKING: Change extra name `amazon_ses` to
  `amazon-ses`, to comply with Python packaging
  name normalization
- Use hatch custom build hook to freeze version number
  in readme (previously custom setup.py code)
- Move separate requirements for dev, docs, tests
  into their own requirements.txt files
- Fix AnymailImproperlyInstalled to correctly refer
  to package extra name
- Update testing documentation
- Update docs readme rendering to match PyPI
  (and avoid setup.py)
- In tox tests, use isolated builds and update pip
- Remove AUTHORS.txt (it just referred to GitHub)
2023-05-03 16:55:08 -07:00
Mike Edmunds
7d993ee610 Fix fail_silently when session/client creation fails
Make sure backends actually fail silently when asked
(rather than raising inaccurate errors suggesting
coding problems).

Fixes #308
2023-05-02 12:38:18 -07:00
Mike Edmunds
1ba26e1be3 Fix empty strings in AnymailInboundMessage from/to/cc
Fix AnymailInboundMessage.to, .cc, .from_email when
message was built with AnymailInboundMessage.construct
using empty strings for those params. (Postmark inbound
relies on this.)

Fixes #307
2023-05-02 11:42:00 -07:00
Therry van Neerven
885eb9b98a Postmark: workaround invalid "test inbound" data
Postmark's "test" button in their inbound settings
posts data with attachments that don't match their docs or
actual inbound behavior. Accept that and issue a warning.

Closes #304
2023-04-22 12:00:05 -07:00
Mike Edmunds
62bd0669af MailerSend: add support (new ESP for Anymail)
Closes #298
2023-03-10 17:22:20 -08:00
Mike Edmunds
c58640d438 Mandrill: update integration test
Mandrill bad API key can respond either 401 or 500,
so don't bother checking exact status code. 
(Just make sure it results in a useful error.)
2023-03-09 09:56:42 -08:00
Mike Edmunds
ea446a94d3 Amazon SES: implement SES v2 API backend
* Add `anymail.backends.amazon_sesv2.EmailBackend` using SES v2 API
* Declare current SES v1 backend as "deprecated"

Closes #274
2023-02-26 14:16:46 -08:00
medmunds
f5f3fc86e6 Simplify url patterns
Favor `django.urls.path` over `re_path` where possible.
2023-02-08 14:23:15 -08:00
medmunds
ec864f5165 Tests: simplify test_settings maintenance
If no version-specific tests.test_settings.settings* file
exists for the current Django version, fall back to an
earlier settings file.

- runtests.py find latest settings_N_M earlier than or
  matching Django version N.M being tested, rather than
  requiring exact match
- remove test_settings files that were just duplicates
  of earlier versions
2023-02-08 11:03:06 -08:00
medmunds
f71813f820 Fix Sendinblue integration test
Fix change apparently introduced by black?
(Unclear why this didn't cause integration test failure
when run in PR branch.)
2023-02-06 15:36:29 -08:00
medmunds
b4e22c63b3 Reformat code with automated tools
Apply standardized code style
2023-02-06 15:05:24 -08:00
medmunds
287c2175f4 Sendinblue: Support send_at
Add support for delayed sending via
Sendinblue's public beta "scheduledAt"
parameter.

Closes #280
2022-12-18 15:53:45 -08:00
medmunds
681a4afe6b Sendinblue: fix "invalid headers" error
Work around recent (unannounced) Sendinblue API change
that caused "Invalid headers" API error with non-string
custom header values, by converting basic numeric types
to strings. (Borrowed code from SendGrid backend.)

Fixes #288
2022-11-04 16:46:25 -07:00
medmunds
3f05623a2f Drop support for Django 2.x and Python 3.5 2022-08-29 13:25:47 -07:00
Tim Schilling
a4f50c4340 Confirm support for Django 4.1
Replaces deprecated `django.utils.timezone.utc` with
`datetime.timezone.utc` (available since Python 3.2).
2022-08-24 13:24:27 -07:00
medmunds
6b3775a8e9 Tests: fix SparkPost integration test
SparkPost has changed http status for bad API key
from 403 Forbidden to 401 Unauthorized.
2022-07-28 14:29:29 -04:00
medmunds
748ac9fea7 Tests: fix SparkPost integration test
SparkPost has switched http status for bad API key.
2022-07-28 11:56:19 -04:00
puru02
48de044c9b Fix: Postmark tracking webhook handle SubscriptionChange events
Handle Postmark SubscriptionChange events as Anymail 
unsubscribe, subscribe, or bounce Anymail tracking events.
2022-06-07 17:28:39 -07:00
medmunds
09f21a5c2d Mailgun/SendGrid inbound: workaround Django filename issue
Workaround for Django multipart/form-data limitation
where certain attachment filenames cause fields to be dropped
or to end up in request.POST rather than request.FILES.

Handle the MultiValueDictKeyError in inbound webhooks when
this has occurred. Also update docs to recommend avoiding
the problem by using Mailgun and SendGrid's "raw MIME" options.

Also handle reported cases of empty, duplicate keys in Mailgun's
content-id-map.

Fixes #272
2022-05-13 10:19:12 -07:00
medmunds
ddeb938a3c Mandrill: re-enable integration tests
Get Mandrill integration tests working again,
by using a test-mode API key and a trial account.
2022-02-02 16:36:11 -08:00
medmunds
41147b581c Mandrill: don't send unnecessary empty fields
Don't add empty Reply-To header and empty display names
to Mandrill send API data.

Fixes #262
2022-02-02 16:36:11 -08:00
Mike Edmunds
5fdc285e82 CI/Docs: move to anymail.dev
Move all integration tests and contact emails to anymail.dev. 
(Stop using anymail.info.)
2022-02-02 13:59:09 -08:00