Commit Graph

118 Commits

Author SHA1 Message Date
medmunds
742868d68c Docs: missed param in pre_send signature
[ci skip]
2016-05-13 12:17:27 -07:00
medmunds
f8eafba0df Add pre_send and post_send signals
Closes #8
2016-05-12 21:18:04 -07:00
medmunds
d4f6ffbb41 Show DeprecationWarning, etc. in runtests
Install default warnings filter in test runs, to avoid
python's default suppression of DeprecationWarning
and other "intended for developer" warnings.

(Avoids need to provide -Wd or -Wall arg to runtests.)
2016-05-12 17:42:44 -07:00
medmunds
a0b92bee7a Mandrill: support esp_extra
* Merge esp_extra with Mandrill send payload
* Handle pythonic forms of `recipient_metadata`
  and `template_content` in esp_extra
* DeprecationWarning for Mandrill EmailMessage
  attributes inherited from Djrill
2016-05-11 15:08:57 -07:00
Linus Schoemaker
23353de8e6 Fix syntax error in installation instructions 2016-05-09 11:34:04 +02:00
medmunds
75730e8219 Add ESP templates, batch send and merge
* message.template_id to use ESP stored templates
* message.merge_data and merge_global_data
  to supply per-recipient/global merge variables
  (with or without an ESP stored template)
* When using per-recipient merge_data, tell ESP to use
  batch send: individual message per "to" address.
  (Mailgun does this automatically; SendGrid requires
  using a different "to" field; Mandrill requires
  `preserve_recipients=False`; Postmark doesn't
  support *this type* of batch sending with merge data.)
* Allow message.from_email=None (must be set after
  init) and message.subject=None to suppress those
  fields in API calls (for ESPs that allow "From" and
  "Subject" in their template definitions).

Mailgun:
* Emulate merge_global_data by copying to
  recipient-variables for each recipient.

SendGrid:
* Add delimiters to merge field names via
  esp_extra['merge_field_format'] or
  ANYMAIL_SENDGRID_MERGE_FIELD_FORMAT setting.

Mandrill:
* Remove Djrill versions of these features;
  update migration notes.

Closes #5.
2016-05-06 12:27:11 -07:00
medmunds
1372ef21eb SendGrid: merge 'filters' in esp_extra
Previously, setting esp_extra['x-smtpapi']['filters']
would override the entire filters setting, potentially
undoing other Anymail options that use SendGrid
filters (like track_opens).

Now, 'filters' is special-cased, and merged with
any other Anymail filter options.

(We don't do a fully deep merge, because otherwise
there would be no way to use esp_extra to *clear*
Anymail settings.)
2016-04-30 10:21:11 -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
6b415eeaae Docs: note limited Mandrill support
Mandrill has disabled our test account and API key,
so future development will be purely against their docs.

[ci skip]
2016-04-29 11:21:11 -07:00
medmunds
8e43f29944 Workaround missing smtp-id in SendGrid tracking.
* Add smtp-id in unique_args (metadata), to ensure
  it shows up in click and open events.
* Add SENDGRID_GENERATE_MESSAGE_ID setting,
  default True, to control auto-Message-ID behavior.
* Document it.
2016-04-29 09:44:31 -07:00
Mike Edmunds
ca7dbdcec6 Docs: clarify ESP templates not yet implemented 2016-04-26 09:39:41 -07:00
medmunds
385d76b53a Move tests out of app module
(Directory structure as suggested in
[Django testing docs][1].)

[1]: https://docs.djangoproject.com/en/1.9/topics/testing/advanced/#using-the-django-test-runner-to-test-reusable-applications
2016-03-21 11:38:58 -07:00
medmunds
12229ab116 Docs: make ESP feature matrix maintainable
(reST substitutions bring the table width back within
a normal editor's width!)

[ci skip]
2016-03-14 19:48:47 -07:00
medmunds
1a1e5ba1a8 docs: update tagline 2016-03-14 13:42:56 -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
f95bf1fbc4 Docs: typos, formatting
[ci skip]
2016-03-14 13:01:30 -07:00
medmunds
7bbd1c7e4e SendGrid: support username/password auth
Closes #9
2016-03-14 12:39:41 -07:00
medmunds
9462d03dc1 Docs: add ESP feature support matrix
[ci skip]
2016-03-14 11:34:33 -07:00
medmunds
34d6676afa Add Postmark support 2016-03-14 11:06:45 -07:00
medmunds
54827579d3 Improve inline-image handling
* Add filename param to attach_inline_image

* Add attach_inline_image_file function
  (parallels EmailMessage.attach and attach_file)

* Use `Content-Disposition: inline` to decide
  whether an attachment should be handled inline
  (whether or not it's an image, and whether or not
  it has a Content-ID)

* Stop conflating filename and Content-ID, for
  ESPs that allow both. (Solves problem where
  Google Inbox was displaying inline images
  as attachments when sent through SendGrid.)
2016-03-11 19:14:11 -08:00
medmunds
e15cb46daf Implement SendGridBackend
Covers most of #1
2016-03-11 16:17:02 -08:00
medmunds
7920a4537c Docs: Clarify AnymailMessage not required 2016-03-10 16:57:26 -08:00
medmunds
b6bbdf4791 The *package* name is "django-anymail"
(not just "anymail")
2016-03-09 20:27:44 -08:00
medmunds
6ef1349b65 GitHub doesn't like Sphinx directives in rst 2016-03-09 19:30:34 -08:00
medmunds
1e80c3ec37 Invert unsupported-features setting
Change from UNSUPPORTED_FEATURE_ERRORS
(default True) to IGNORE_UNSUPPORTED_FEATURES
(default False). Parallels IGNORE_RECIPIENT_STATUS.
2016-03-09 18:47:42 -08:00
medmunds
20c6350140 Update (almost) all the docs 2016-03-09 18:37:11 -08:00
medmunds
8f0f2d3d83 Use RTD Sphinx theme for local doc builds 2016-03-07 19:21:28 -08:00
medmunds
921dd5d0d6 Fork from Djrill and rename to "anymail" 2016-02-27 11:16:04 -08:00
medmunds
f95d5d66dc Avoid weak ref to local signal receiver in webhook tests.
Webhook tests define a local signal receiver function,
so connect it using the `weak=False` option to set
a good example.

(This isn't technically needed in the tests: the test receivers
are only connected while their definitions are still in scope,
so they couldn't possibly be garbage collected. But it doesn't
hurt, and it's good practice in case the test code gets copied.)

Also update the webhook docs to have a direct link to
Django's "listening to signals" info.
2016-02-04 12:14:01 -08:00
medmunds
79eaac42c4 Handle Mandrill sync event webhooks
Fixes #108
2016-02-03 19:29:26 -08:00
medmunds
5d4440ef5d Open v2.1 development
[ci skip]
2015-12-02 20:06:32 -08:00
medmunds
ed77987552 Docs: couple more release notes 2015-12-02 18:39:08 -08:00
medmunds
7706a5d39f Docs: 2.0 upgrade guide, release notes 2015-12-02 18:25:26 -08:00
medmunds
d496555813 Docs: remove pre-2.0 versionadded/versionchanged
(Cut the old-version clutter)
2015-12-02 17:06:15 -08:00
medmunds
265c7460e0 Support Django 1.9 release 2015-12-02 16:59:34 -08:00
medmunds
02641b0959 Improve send_at docs
* Try to clear up timezones
* Note requirement for funded account
2015-12-02 16:52:42 -08:00
medmunds
d82d425aa8 Clean up mandrill_reponse docs
Document mandrill_response as an attribute
(not just a generic topic).
2015-12-02 16:18:57 -08:00
medmunds
9971c1780f Document MANDRILL_API_URL 2015-12-02 16:10:29 -08:00
medmunds
aa46fadb48 Clean up global MANDRILL_SETTINGS
* Clean up Djrill backend __init__
* Fold MANDRILL_SUBACCOUNT into
  global_settings logic
* Add some missing override tests
* Update docs
2015-12-02 15:58:23 -08:00
medmunds
fe1e2d1ae5 Refactor backend
* Break apart massive _send call
* Try to facilitate subclassing
* Centralize fail_silently handling during _send
* Include original EmailMessage as exception attr
2015-12-02 12:41:26 -08:00
medmunds
b8cdc6ce82 Cleanup Djrill exceptions
* Add common base DjrillException

* Simplify backend by moving logic
  to describe errors into base DjrillException

* Add NotSerializableForMandrillError
  for JSON serialization errors
2015-12-02 10:52:20 -08:00
medmunds
d14b87c910 Raise error for invalid/rejected recipients
Raise new MandrillRecipientsRefused exception
when Mandrill returns 'reject' or 'invalid' status
for *all* recipients of a message.

(Similar to Django's SMTP email backend raising
SMTPRecipientsRefused.)

Add setting MANDRILL_IGNORE_RECIPIENT_STATUS
to override the new exception.

Trap JSON parsing errors in Mandrill API response,
and raise MandrillAPIError for them. (Helps with #93.)

Closes #80.
Closes #81.
2015-12-01 13:26:21 -08:00
medmunds
3a6e0ebb30 Clean up session sharing
* Test cases
* Fix premature session.close when caller
  is managing email backend connection
* Ensure session closed correct in exceptions
* Changelog

(Also fixes bug where JSON serialization errors
didn't respect fail_silently.)
2015-11-30 16:50:58 -08:00
medmunds
942a6df8c3 Drop unintended json date encoding 2015-11-29 14:42:12 -08:00
medmunds
699216ba00 Drop legacy DjrillBackendHTTPError exception 2015-11-29 12:55:16 -08:00
medmunds
209f9573ff Drop legacy DjrillMessage class 2015-11-29 12:37:00 -08:00
William Hector
7179734a08 Allow global_merge_vars to be merged in with the per message dict, with keys in the latter taking precedent.
Update the docs accordingly.
2015-07-14 05:57:12 +01:00
William Hector
883b23362c Allow Mandrill specific options to be set globally in the settings file.
This is useful to set options such as tracking_domain etc per instance when using subaccounts with Mandrill.
2015-07-12 01:19:59 +01:00
medmunds
da260de1a0 Drop support for Django 1.3, Python 2.6 and 3.2.
* Shrink the Travis test matrix
* Remove a lot of backported test code
* Update requirements in setup.py
* Update docs

Closes #79
2015-05-14 11:39:57 -07:00