PageRenderTime 3ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Doc/library/email-examples.rst

http://unladen-swallow.googlecode.com/
ReStructuredText | 40 lines | 22 code | 18 blank | 0 comment | 0 complexity | c15b52ba4bc10ce4910cda3b0e94e1c3 MD5 | raw file
 1.. _email-examples:
 2
 3:mod:`email`: Examples
 4----------------------
 5
 6Here are a few examples of how to use the :mod:`email` package to read, write,
 7and send simple email messages, as well as more complex MIME messages.
 8
 9First, let's see how to create and send a simple text message:
10
11.. literalinclude:: ../includes/email-simple.py
12
13
14Here's an example of how to send a MIME message containing a bunch of family
15pictures that may be residing in a directory:
16
17.. literalinclude:: ../includes/email-mime.py
18
19
20Here's an example of how to send the entire contents of a directory as an email
21message: [1]_
22
23.. literalinclude:: ../includes/email-dir.py
24
25
26Here's an example of how to unpack a MIME message like the one
27above, into a directory of files:
28
29.. literalinclude:: ../includes/email-unpack.py
30
31Here's an example of how to create an HTML message with an alternative plain
32text version: [2]_
33
34.. literalinclude:: ../includes/email-alternative.py
35
36
37.. rubric:: Footnotes
38
39.. [1] Thanks to Matthew Dixon Cowles for the original inspiration and examples.
40.. [2] Contributed by Martin Matejek.