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.
This commit is contained in:
medmunds
2017-01-20 15:47:37 -08:00
parent bff01b440a
commit 79288603fb
29 changed files with 190 additions and 71 deletions

View File

@@ -17,10 +17,9 @@ To use Anymail's Mailgun backend, set:
.. code-block:: python
EMAIL_BACKEND = "anymail.backends.mailgun.MailgunBackend"
EMAIL_BACKEND = "anymail.backends.mailgun.EmailBackend"
in your settings.py. (Watch your capitalization: Mailgun spells their name with a
lowercase "g", so Anymail does too.)
in your settings.py.
.. setting:: ANYMAIL_MAILGUN_API_KEY

View File

@@ -33,7 +33,7 @@ To use Anymail's Mandrill backend, set:
.. code-block:: python
EMAIL_BACKEND = "anymail.backends.mandrill.MandrillBackend"
EMAIL_BACKEND = "anymail.backends.mandrill.EmailBackend"
in your settings.py.

View File

@@ -19,10 +19,9 @@ To use Anymail's Postmark backend, set:
.. code-block:: python
EMAIL_BACKEND = "anymail.backends.postmark.PostmarkBackend"
EMAIL_BACKEND = "anymail.backends.postmark.EmailBackend"
in your settings.py. (Watch your capitalization: Postmark spells their name with a
lowercase "m", so Anymail does too.)
in your settings.py.
.. setting:: ANYMAIL_POSTMARK_SERVER_TOKEN

View File

@@ -34,10 +34,9 @@ To use Anymail's SendGrid backend, set:
.. code-block:: python
EMAIL_BACKEND = "anymail.backends.sendgrid.SendGridBackend"
EMAIL_BACKEND = "anymail.backends.sendgrid.EmailBackend"
in your settings.py. (Watch your capitalization: SendGrid spells
their name with an uppercase "G", so Anymail does too.)
in your settings.py.
.. setting:: ANYMAIL_SENDGRID_API_KEY

View File

@@ -33,10 +33,9 @@ To use Anymail's SparkPost backend, set:
.. code-block:: python
EMAIL_BACKEND = "anymail.backends.sparkpost.SparkPostBackend"
EMAIL_BACKEND = "anymail.backends.sparkpost.EmailBackend"
in your settings.py. (Watch your capitalization: SparkPost spells
their name with an inner capital "P", so Anymail does too.)
in your settings.py.
.. setting:: ANYMAIL_SPARKPOST_API_KEY

View File

@@ -54,7 +54,7 @@ To use Anymail for sending email, edit your Django project's :file:`settings.py`
.. code-block:: python
EMAIL_BACKEND = "anymail.backends.mailgun.MailgunBackend"
EMAIL_BACKEND = "anymail.backends.mailgun.EmailBackend"
(:setting:`EMAIL_BACKEND` sets Django's default for sending emails; you can also
use :ref:`multiple Anymail backends <multiple-backends>` to send particular

View File

@@ -18,7 +18,7 @@ but send admin emails directly through an SMTP server:
from django.core.mail import send_mail, get_connection
# send_mail connection defaults to the settings EMAIL_BACKEND, which
# we've set to Anymail's MailgunBackend. This will be sent using Mailgun:
# we've set to Anymail's Mailgun EmailBackend. This will be sent using Mailgun:
send_mail("Thanks", "We sent your order", "sales@example.com", ["customer@example.com"])
# Get a connection to an SMTP backend, and send using that instead:
@@ -27,13 +27,13 @@ but send admin emails directly through an SMTP server:
connection=smtp_backend)
# You can even use multiple Anymail backends in the same app:
sendgrid_backend = get_connection('anymail.backends.sendgrid.SendGridBackend')
sendgrid_backend = get_connection('anymail.backends.sendgrid.EmailBackend')
send_mail("Password reset", "Here you go", "noreply@example.com", ["user@example.com"],
connection=sendgrid_backend)
# You can override settings.py settings with kwargs to get_connection.
# This example supplies credentials to use a SendGrid subuser acccount:
alt_sendgrid_backend = get_connection('anymail.backends.sendgrid.SendGridBackend',
alt_sendgrid_backend = get_connection('anymail.backends.sendgrid.EmailBackend',
username='marketing_subuser', password='abc123')
send_mail("Here's that info", "you wanted", "marketing@example.com", ["prospect@example.com"],
connection=alt_sendgrid_backend)