289 Commits

Author SHA1 Message Date
Mike Edmunds
77b9701b5e Postmark: Handle responses with missing ErrorCode and "delivery may be delayed".
Fixes #392.
2024-12-10 13:01:18 -08:00
Mike Edmunds
8def0bdc06 Mailjet: Don't try to parse non-JSON responses as JSON.
Fixes #409.
2024-12-10 12:30:36 -08:00
Mike Edmunds
c7f7428b7a Mailjet: Prevent empty attachment filename
Mailjet requires all attachments/inlines have a non-empty Filename field.
Substitute `"attachment"` for missing filenames.

Fixes #407.
2024-12-10 12:29:34 -08:00
Mike Edmunds
35383c7140 Release 12.0 2024-09-09 12:25:26 -07:00
Mike Edmunds
063fb08a58 Amazon SES: add webhook extension points; close webhook boto3 clients
In Amazon SES webhook views (tracking and inbound):
- Close boto3 clients after use. (Not strictly required, but doesn't hurt.
  Amazon SES backend was already doing this.)
- Break out some webhook functionality to simplify subclassing.
  (E.g., to handle S3 object encryption through outside tooling, as
  AWS hasn't released a Python version of their S3 encryption client.)
2024-09-09 11:34:46 -07:00
Mike Edmunds
e4331d2249 Unisender Go: Fix status tracking webhook and tests.
- Fix signature checking to avoid false validation errors
  on webhook payloads including `/` (including all "clicked"
  and most "opened" events). And in general, avoid depending
  on specific details of Unisender Go's JSON serialization.
  (Fixes #398.)
- Handle "use single event" webhook option (which has a different
  payload format).
- Verify basic auth when Anymail's WEBHOOK_SECRET is used.
  (This is optional for Unisender Go, since payloads are signed,
  but it needs to be checked when enabled.)
- Treat "soft_bounced" events as "deferred" rather than "bounced",
  since they will be retried later.
- Update validation error to reference Project ID if the webhook
  is configured for a specific project.
- Expose Unisender Go's delivery_status code and unsubscribe form
  comment as Anymail's normalized event.description.
- Update webhook tests based on actual payloads and add several
  missing tests.
- Update docs to clarify webhook use with Unisender Go projects.
2024-09-08 15:27:47 -07:00
Mike Edmunds
2f2a888f61 Resend: add support for send_at
Resend's new `scheduled_at` API field allows delayed sending
(though not with attachments or batch sending).

Closes #396.
2024-09-06 11:36:40 -07:00
Mike Edmunds
9c4cf001d0 Drop Django 3.0, 3.1, 3.2. Drop Python 3.7. 2024-08-07 12:59:47 -07:00
Mike Edmunds
6cb1a8b4e9 Release 11.1 2024-08-07 12:37:35 -07:00
Luis Nell
d05f448891 Brevo: support proxy open, complained, error events
Add support for Brevo's new "Complained," "Error" and 
"Loaded by proxy" events in Brevo tracking webhook.

Closes #385.

---------

Co-authored-by: Mike Edmunds <medmunds@gmail.com>
2024-07-25 11:52:32 -07:00
Mike Edmunds
136ba59ceb Release 11.0.1 2024-07-11 13:02:30 -07:00
Mike Edmunds
78ccd72fbe Release 11.0 2024-06-23 13:22:31 -07:00
Mike Edmunds
567fbb52ab Amazon SES: Fix header encoding problem
A combination of long display name and
commas (or other special characters) could
result in invalid address headers.
See details in #369.

Fix by removing unnecessary email.policy
override, which was causing new header folding
code to run with headers built using Compat32
legacy header encoding. The two don't mix.

Fixes #369
2024-06-22 16:52:45 -07:00
Mike Edmunds
c4b2e08b16 SparkPost: error on features incompatible with template_id
Raise an `AnymailUnsupportedFeature` error
when trying to use a `template_id` along with
other content payload fields that SparkPost
silently ignores when template_id is present.
2024-06-22 14:47:51 -07:00
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
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
daef82c158 Amazon SES: improve missing client error 2024-05-16 11:37:19 -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
fc1bd1497f Release 10.3 2024-03-12 11:46:20 -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
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
e15b3ce1ec Release 10.2 2023-10-25 13:01:30 -07: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
f911ee78a0 Fix Python 3.12 deprecation warning 2023-09-22 11:08:20 -07:00
Mike Edmunds
de44b938e9 Release 10.1 2023-07-31 10:45:38 -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
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
099ef314e4 Release 10.0 2023-05-07 12:09:28 -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
9fba58237d Drop support for Python 3.6 and old urllib3 2023-05-02 13:59:01 -07:00
Mike Edmunds
485766182e Release 9.2 2023-05-02 13:03:31 -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
Mike Edmunds
fdac3bfe37 Import make_msgid from correct package 2023-05-02 11:26:29 -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
c59ad9e7a1 Release 9.1 2023-03-11 11:44:02 -08:00