Commit Graph

140 Commits

Author SHA1 Message Date
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
45848440b3 Postal: Don't try to install cryptography on Python 3.8
The cryptography package is no longer installable on PyPy 3.8, because PyO3
requires Python 3.9. Since there were already problems installing cryptography
on darwin-arm64 for cpython 3.8 (and since cpython 3.8 passed EOL on all platforms
last month), just limit Postal's extra dependency on cryptography to Python >=3.9.

If you are using Postal tracking webhooks with Python 3.8, you'll get an ImportError
unless you also install cryptography somehow (or upgrade to Python 3.9 or later).
2024-11-30 14:42:23 -08:00
Mike Edmunds
35383c7140 Release 12.0 2024-09-09 12:25:26 -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
af6eaea565 Docs: Note Mandrill's cc/bcc handling depends on preserve_recipients
Closes #391
2024-09-06 10:44:35 -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
f86c019e1d Docs: Amazon SES: fix IAM policy recommendations
Correct IAM action permissions required for
Amazon SES v2 API.

Fixes #384
2024-07-11 12:37:22 -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
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
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
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
97fe8162bf Test: enable Django 5.0alpha and Python 3.12rc 2023-09-22 11:08:20 -07:00
Mike Edmunds
6c5b6b76fc Mailgun (docs): Clarify API keys
Explain account-level "Mailgun API keys"
vs. domain-level "sending API keys."
2023-08-24 17:44:33 -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
8c31883c1a Tests: get tox py36 tests working again
tox dependency virtualenv dropped support for creating
Python 3.6 environments in a minor release. [1]

Announce deprecation of Anymail Python 3.6 support.
Until that can take effect, pin an older version of
virtualenv that still works for tox py36 testenv.

[1]: See https://github.com/pypa/virtualenv/pull/2548#issuecomment-1527278210 et seq
2023-05-02 10:23:55 -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
d9a80e7347 Tests: Test release version of Django 4.2 2023-04-03 12:18:34 -07:00
Mike Edmunds
c59ad9e7a1 Release 9.1 2023-03-11 11:44:02 -08:00
Mike Edmunds
62bd0669af MailerSend: add support (new ESP for Anymail)
Closes #298
2023-03-10 17:22:20 -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