Commit Graph

24 Commits

Author SHA1 Message Date
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
medmunds
b4e22c63b3 Reformat code with automated tools
Apply standardized code style
2023-02-06 15:05:24 -08:00
medmunds
10f569cd50 Fix: don't include sender/recipient in AnymailError description
Remove `AnymailError.describe_send`, which added sender and
recipient email addresses to every AnymailError message
(whether or not relevant to the error).

Addresses #245
2022-01-11 17:03:03 -08:00
Mike Edmunds
85cec5e9dc Drop Python 2 and Django 1.11 support
Minimum supported versions are now Django 2.0, Python 3.5.

This touches a lot of code, to:
* Remove obsolete portability code and workarounds
  (six, backports of email parsers, test utils, etc.)
* Use Python 3 syntax (class defs, raise ... from, etc.)
* Correct inheritance for mixin classes
* Fix outdated docs content and links
* Suppress Python 3 "unclosed SSLSocket" ResourceWarnings
  that are beyond our control (in integration tests due to boto3, 
  python-sparkpost)
2020-08-01 14:53:10 -07:00
medmunds
5dce0895f1 Fix UnicodeEncodeError error while reporting invalid email address.
Fixes #148.
2019-05-19 11:19:21 -07:00
medmunds
acd3ca00c8 Improve ESP response formatting in error messages 2019-02-19 17:22:01 -08:00
medmunds
dd26fd3108 Don't require boto3 if Amazon SES webhooks aren't actually used
Delay raising AnymailImproperlyInstalled from webhooks.amazon_ses
until an SES webhook view is instantiated. Allows anymail.urls
to import webhooks.amazon_ses without error.

Fixes #103
2018-04-16 15:41:00 -07:00
Peter Wu
e39614e5a5 Mailjet backend support (#66)
Add Mailjet backend. (Docs and webhooks to follow.)

Thanks to @Lekensteyn and @calvin.
2017-06-30 16:33:53 -07:00
medmunds
56d2b53c2b Use specific ESP name in error messages.
Change  (e.g.,) "ESP API response 400"
to "Mailgun API response 400".
2017-01-22 10:21:19 -08:00
medmunds
79288603fb Rename EmailBackends for Django consistency
* **Future breaking change:**
  Rename all Anymail backends to just `EmailBackend`,
  matching Django's naming convention.
  (E.g., switch to "anymail.backends.mailgun.EmailBackend"
  rather than "anymail.backends.mailgun.MailgunBackend".)

  The old names still work, but will issue a DeprecationWarning
  and will be removed in some future release.

  (Apologies for this change; the old naming convention was
  a holdover from Djrill, and I wanted consistency with
  other Django EmailBackends before hitting 1.0.)

Fixes #49.
2017-01-20 15:47:37 -08:00
medmunds
d0596d100b Raise error for invalidly-formatted email addresses.
A message's `from_email` and each address in its `to`, `cc`, and `bcc` lists must contain exactly one email address. Previous code would silently ignore additional addresses, leading to unusual behavior. Now, raises new `AnymailInvalidAddress` exception.

Example: `from_email='Widgets, Inc. <widgets@example.com>'` is invalid: it needs double-quotes around the "Widgets, Inc." display-name portion. In earlier versions, this probably would have sent the message from something like "From: Widgets <@localhost>". Now, it will raise an exception.

**Potentially-breaking change:** If your code is using an unquoted display-name containing a comma in an email address, it will now raise an error. In earlier versions, this may have appeared to succeed, but was almost certainly not doing what you intended.

Fixes #44.
2016-12-15 13:57:49 -08:00
medmunds
1ea9ab6fee Upgrade requests exceptions to AnymailRequestsAPIError
Catch and re-raise requests.RequestException in
AnymailRequestsBackend.post_to_esp.

* AnymailRequestsAPIError is needed for proper
  fail_silently handling.
* Retain original requests exception type, to avoid
  breaking existing code that might look for specific
  requests exceptions.

Closes #16
2016-06-01 10:18:27 -07:00
medmunds
f8eafba0df Add pre_send and post_send signals
Closes #8
2016-05-12 21:18:04 -07:00
medmunds
d3f914be12 Event-tracking webhooks
Closes #3
2016-04-29 18:10:50 -07:00
medmunds
df881fdb75 Allow kwargs overrides for (nearly) all settings
* Update utils.get_anymail_setting to support
  kwargs override of django.conf.settings values
* Use the updated version everywhere
* Switch from ImproperlyConfigured to
  AnymailConfigurationError exception
  (anticipates feature_wehooks change)

Closes #12
2016-04-29 14:34:34 -07:00
medmunds
fed98b14a8 install: remove need to name [esp]
Simplify install to just `pip install django-anymail`.
(Rather than `... django-anymail[mailgun]`

All of the ESPs so far require requests, so just move
that into the base requirements. (Chances are your
Django app already needs requests for some other
reason, anyway.)

Truly unique ESP dependencies (e.g., boto for
AWS-SES) could still use the setup extra features
mechanism.
2016-03-14 13:26:06 -07:00
medmunds
e15cb46daf Implement SendGridBackend
Covers most of #1
2016-03-11 16:17:02 -08:00
medmunds
b6bbdf4791 The *package* name is "django-anymail"
(not just "anymail")
2016-03-09 20:27:44 -08:00
medmunds
0a5bca1426 Make requests optional for backends that don't need it
(Prep for installing backends as package extras)

* Extract AnymailRequestsBackend and RequestsPayload
  to base_requests.py
* Don't define/require requests exceptions when requests
  not available
2016-03-04 17:39:43 -08:00
medmunds
38729df93c Uniform settings handling
For MANDRILL_API_KEY (e.g.,), look for these settings:
* ANYMAIL = { 'MANDRILL_API_KEY': '...' }
* ANYMAIL_MANDRILL_API_KEY = "..."
* MANDRILL_API_KEY = "..."

(the "bare" third version is used only for settings that
might be reasonably shared with other apps, like api keys)
2016-03-04 17:02:43 -08:00
medmunds
3b414a9619 Move all the payload construction into Payload classes 2016-03-04 15:55:19 -08:00
medmunds
ef971489cd Start factoring out common backend functionality 2016-02-29 11:52:35 -08:00
medmunds
1c7fe8a759 Rename exceptions
* Change Djrill -> Mandrill in exception names
* Don't re-export at package level
  (import from anymail.exceptions, not from anymail)
2016-02-27 12:03:45 -08:00
medmunds
921dd5d0d6 Fork from Djrill and rename to "anymail" 2016-02-27 11:16:04 -08:00