blob: 64a9944335de9a4970ed72d077578a34f2e3f7c8 [file] [log] [blame]
Georg Brandl116aa622007-08-15 14:28:22 +00001:mod:`email`: Examples
2----------------------
3
4Here are a few examples of how to use the :mod:`email` package to read, write,
5and send simple email messages, as well as more complex MIME messages.
6
7First, let's see how to create and send a simple text message:
8
9.. literalinclude:: ../includes/email-simple.py
10
11
12Here's an example of how to send a MIME message containing a bunch of family
13pictures that may be residing in a directory:
14
15.. literalinclude:: ../includes/email-mime.py
16
17
18Here's an example of how to send the entire contents of a directory as an email
19message: [1]_
20
21.. literalinclude:: ../includes/email-dir.py
22
23
24And finally, here's an example of how to unpack a MIME message like the one
25above, into a directory of files:
26
27.. literalinclude:: ../includes/email-unpack.py
28
29
30.. rubric:: Footnotes
31
32.. [1] Thanks to Matthew Dixon Cowles for the original inspiration and examples.
33