Skip to content

Commit 770f7dd

Browse files
author
Rich Leland
committed
Update docs with more detailed Django information
1 parent 303fbfc commit 770f7dd

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ The SparkPost python library comes with an email backend for Django. Put the fol
9595
SPARKPOST_API_KEY = 'API_KEY'
9696
EMAIL_BACKEND = 'sparkpost.django.email_backend.SparkPostEmailBackend'
9797
98-
Replace *API_KEY* with an actual API key that you've generated in `Get a Key`_ section.
98+
Replace *API_KEY* with an actual API key that you've generated in `Get a Key`_ section. Check out the `full documentation`_ on the Django email backend.
99+
100+
.. _full documentation: http://python-sparkpost.readthedocs.org/en/latest/django/backend.html
99101

100102
Documentation
101103
-------------

docs/django/backend.rst

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,39 @@ Django is now configured to use the SparkPost email backend. You can now send ma
3737
from django.core.mail import send_mail
3838
3939
send_mail(
40-
subject='hello from sparkpost',
41-
message='Hello Rock stars!'
40+
subject='Hello from SparkPost',
41+
message='Woo hoo! Sent from Django!'
4242
from_email='[email protected]',
43-
recipient_list=['to@friendsdomain.com'],
43+
recipient_list=['to@example.com'],
4444
html_message='<p>Hello Rock stars!</p>',
4545
)
4646
47+
If you need to add cc, bcc, reply to, or attachments, use the `EmailMultiAlternatives` class directly:
4748

48-
Supported version
49-
-----------------
50-
SparkPost will support all versions of Django that are within extended support period. Refer to `Django Supported_Version`_.
49+
.. code-block:: python
50+
51+
from django.core.mail import EmailMultiAlternatives
52+
53+
email = EmailMultiAlternatives(
54+
subject='hello from sparkpost',
55+
message='Woo hoo! Sent from Django!'
56+
from_email='[email protected]',
57+
58+
59+
60+
reply_to=['[email protected]']
61+
)
5162
52-
Current supported versions are:
53-
* 1.7
54-
* 1.8
55-
* 1.9b1
63+
email.attach_alternative('<p>Woo hoo! Sent from Django!</p>', 'text/html')
64+
email.attach('image.png', img_data, 'image/png')
65+
email.send()
5666
5767
58-
.. _Django Supported_Version: https://www.djangoproject.com/download/#supported-versions
68+
Supported version
69+
-----------------
70+
SparkPost will support all versions of Django that are within extended support period. Refer to `Django Supported Versions`_.
71+
72+
.. _Django Supported Versions: https://www.djangoproject.com/download/#supported-versions
5973

6074

6175
Additional documentation
@@ -64,4 +78,3 @@ Additional documentation
6478
See our `Using SparkPost with Django`_ in support article.
6579

6680
.. _Using SparkPost with Django: https://support.sparkpost.com/customer/en/portal/articles/2169630-using-sparkpost-with-django?b_id=7411
67-

0 commit comments

Comments
 (0)