Skip to content

Commit 46ab669

Browse files
committed
Update README.md to use markdown formatting
1 parent 5f95715 commit 46ab669

1 file changed

Lines changed: 78 additions & 143 deletions

File tree

README.md

Lines changed: 78 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -1,152 +1,87 @@
1-
PMMail, PMBatchMail, and PMBounceManager objects, as well as Django email backend (postmark.django_backend.EmailBackend) for Postmark (http://postmarkapp.com)
2-
3-
CONTRIBUTORS:
4-
Dave Martorana (themartorana)
5-
Bill Jones (oraclebill)
6-
Richard Cooper (frozenskys)
7-
Miguel Araujo (maraujop)
8-
Patrick Lauber (digi604)
9-
Brian McFadden (brimcfadden)
10-
Joel Ryan (joelryan2k)
11-
Ben Hodgson (benhodgson)
12-
Dmitry Golomidov (deeGraYve)
13-
Matt Robenolt (mattrobenolt)
14-
Maxime Bouroumeau-Fuseau (maximebf)
15-
James Arthur (thruflo)
16-
Jacob (nephics)
17-
(Did I miss anyone?)
18-
19-
PYTHON INFORMATION:
20-
Supports Python 2.6, 3.x. Will attempt to use simplejson speedups if installed
21-
22-
CHANGE LOG:
23-
Version 0.4.0
24-
- Merged in Python 3 support - thanks Jacob!
25-
- Moving minimum python version to 2.6. If you need 2.4 support, please continue to use v0.3.2!
26-
27-
Version 0.3.2
28-
- Uses simplejson if installed for faster C _speedups
29-
- PMBatchMail properly chunks large message sets
30-
- Django backend uses PMBatchMail properly
31-
- Use https by default
32-
- Proper testing API key out of the box
33-
- Cleaned up some PMBatchMail properties
34-
- Added a few utility methods (add_message, remove_message) to PMBatchMail
35-
- Added proper value checking to PMBatchMail pre-send
36-
- A BIG THANKS to all new contributors!
37-
38-
Version 0.3.1
39-
- Added batch-messaging support (PMBatchMail object) (deeGraYve)
40-
See http://developer.postmarkapp.com/developer-build.html#batching-messages
41-
42-
Version 0.2.3
43-
- Merged in support for adding a tag through the Django backend (joelryan2k)
44-
- Merged in support for POSTMARK_TEST_MODE overriding and beter settings defaults (benhodgson)
45-
46-
Version 0.2.2
47-
- Merged in email mime import fix from brimcfadden
48-
49-
Version 0.2.1
50-
- Merged in POSTMARK_TEST_MODE Django setting from maraujop
51-
52-
Version 0.2.0
53-
- Merged with frozenskys/master to bring in PMBounceManager
54-
- Support for multiple to/cc (limit: 20 per)
55-
- Changed .recipient to .to (legacy support for .recipient left in)
56-
- Tag support (.tag) added
57-
- Fixed the email endpoint
58-
- Fixed a Django backend issue for multiple recipients (max 20)
59-
60-
Version 0.1.6
61-
- Added a new PMBounceManager Class that allows easy access to the PostMark
62-
bounce API.
63-
64-
Version 0.1.5
65-
- Added ".cc" property for carbon copy recipients. Changed django_backend to
66-
support multiple recipients, and to use "to" rather than "recipients" on the django
67-
mail object to prevent accidental leakage of BCC recipients.
68-
69-
Version 0.1.4
70-
- Added ".reply_to" property. The "ReplyTo" custom header is unallowed by Postmark
71-
now, and their documentation has been updated to reflect the change.
72-
http://developer.postmarkapp.com
73-
74-
Version 0.1.3
75-
- Major fix to the way properties were being used, fixes doc strings in properties
76-
- "custom_headers" is now always a dict, even if set to None
77-
78-
Version 0.1.2
79-
- Added 'custom_headers' property (must be a dictionary) to PMMail object
80-
- Added optional 'test' argument to send function to print JSON message instead of actually sending it
81-
82-
Version 0.1.1:
83-
- Initial release
84-
85-
USAGE:
86-
Make sure you have a Postmark account. Visit
87-
http://postmarkapp.com to sign up for an account.
88-
Requires a Postmark API key.
89-
90-
Import postmark.PMMail to use Postmark. Check
91-
class documentation on PMMail object for more
92-
information.
1+
python-postmark library for [Postmark](http://postmarkapp.com)
2+
================================================================
3+
4+
Supports Python 2.6 and greater, including 3.x.
5+
6+
Includes:
7+
8+
- PMMail
9+
- PMBatchMail
10+
- PMBounceManager
11+
- Django email backend (postmark.django_backend.EmailBackend)
12+
13+
Contributors
14+
--------------
15+
See [CONTRIBUTORS.md](https://github.com/themartorana/python-postmark/blob/master/CONTRIBUTORS.md).
16+
17+
Changelog
18+
----------
19+
20+
Version 0.4.0
21+
- Merged in Python 3 support - thanks Jacob!
22+
- Moving minimum python version to 2.6. If you need 2.4 support, please continue to use v0.3.2!
23+
24+
*[See full changelog](https://github.com/themartorana/python-postmark/blob/master/CHANGELOG.md)*
25+
26+
27+
Usage
28+
-----
29+
Make sure you have a Postmark account. Visit http://postmarkapp.com to sign up for an account. Requires a Postmark API key.
30+
31+
Import `postmark.PMMail` to use Postmark. Check class documentation on `PMMail` object for more information.
9332

94-
DJANGO:
95-
The library can be used stand-alone with Django. You can also
96-
add the settings:
33+
Django
34+
-------
35+
The library can be used stand-alone with Django. You can also add the settings:
36+
37+
```python
38+
POSTMARK_API_KEY = 'your-key'
39+
POSTMARK_SENDER = '[email protected]'
40+
POSTMARK_TEST_MODE = [True/False]
41+
```
9742

98-
POSTMARK_API_KEY = 'your-key'
99-
POSTMARK_SENDER = '[email protected]'
100-
POSTMARK_TEST_MODE = [True/False]
43+
to your settings.py file, and when you create a new PMMail object, it will grab the API key and sender automatically. Make sure the sender email address is one of your Sender Signature email addresses in Postmark. You can also customize the name on the sender by changing the format from '[email protected]' to 'Sender Name <[email protected]>' as long as the email part is part of a Sender Signature in Postmark.
10144

102-
to your settings.py file, and when you create a new PMMail object,
103-
it will grab the API key and sender automatically. Make sure the
104-
sender email address is one of your Sender Signature email addresses
105-
in Postmark. You can also customize the name on the sender by
106-
changing the format from '[email protected]' to
107-
'Sender Name <[email protected]>' as long as the email part is
108-
part of a Sender Signature in Postmark.
45+
Using `POSTMARK_TEST_MODE=True` will not actually send the email, but instead dump the JSON packet that would be sent to Postmarkapp.com. By default this setting is False, and if not specified, will be assumed to be False.
46+
47+
To reoute all Django E-Mail functions like `send_mail()` and `mail_admins()` through postmark use the following setting:
48+
49+
```python
50+
EMAIL_BACKEND = 'postmark.django_backend.EmailBackend'
51+
```
52+
53+
But keep in mind that even when using standard Django functions the sender must be registered with postmarkapp.com.
10954

110-
Using POSTMARK_TEST_MODE=True will not actually send the email, but
111-
instead dump the JSON packet that would be sent to Postmarkapp.com.
112-
By default this setting is False, and if not specified, will
113-
be assumed to be False.
11455

115-
To reoute all Django E-Mail functions like send_mail() and
116-
mail_admins() through postmark use the following setting:
56+
Exceptions
57+
-----------
58+
59+
```python
60+
class PMMailMissingValueException(Exception):
61+
#One of the required values for attempting a send request is missing
62+
63+
class PMMailSendException(Exception):
64+
#Base Postmark send exception
11765

118-
EMAIL_BACKEND = 'postmark.django_backend.EmailBackend'
66+
class PMMailUnauthorizedException(PMMailSendException):
67+
#401: Unathorized sending due to bad API key
11968

120-
But keep in mind that even when using standard Django functions
121-
the sender must be registered with postmarkapp.com.
69+
class PMMailUnprocessableEntityException(PMMailSendException):
70+
# 422: Unprocessable Entity - usually an exception with either the sender not having a matching Sender Signature in Postmark. Read the message details for further information
71+
72+
class PMMailServerErrorException(PMMailSendException):
73+
#500: Internal error - this is on the Postmark server side. Errors are logged and recorded at Postmark.
74+
75+
class PMMailURLException(PMMailSendException):
76+
#A URLError was caught - usually has to do with connectivity and the ability to reach the server. The inner_exception will have the base URLError object.
77+
```
78+
79+
TODO
80+
----
12281

82+
- Add automatic multipart emails via regex stripping of HTML tags from html_body if the .multipart property is set to True
83+
- Refactor PMBounceManager Object and improve error handling within it.
84+
- Add PMBounceManager example to the Django test.
85+
- *Fill out the "Usage" section*
86+
12387

124-
EXCEPTIONS:
125-
PMMailMissingValueException(Exception):
126-
One of the required values for attempting a send request is missing
127-
128-
PMMailSendException(Exception):
129-
Base Postmark send exception
130-
131-
PMMailUnauthorizedException(PMMailSendException):
132-
401: Unathorized sending due to bad API key
133-
134-
PMMailUnprocessableEntityException(PMMailSendException):
135-
422: Unprocessable Entity - usually an exception with either the sender
136-
not having a matching Sender Signature in Postmark. Read the message
137-
details for further information
138-
139-
PMMailServerErrorException(PMMailSendException):
140-
500: Internal error - this is on the Postmark server side. Errors are
141-
logged and recorded at Postmark.
142-
143-
PMMailURLException(PMMailSendException):
144-
A URLError was caught - usually has to do with connectivity
145-
and the ability to reach the server. The inner_exception will
146-
have the base URLError object.
147-
148-
TODO:
149-
Add automatic multipart emails via regex stripping of HTML tags from html_body
150-
if the .multipart property is set to True
151-
Refactor PMBounceManager Object and improve error handling within it.
152-
Add PMBounceManager example to the Django test.

0 commit comments

Comments
 (0)