/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. :mod:`email`: Examples
  3. ----------------------
  4. Here are a few examples of how to use the :mod:`email` package to read, write,
  5. and send simple email messages, as well as more complex MIME messages.
  6. First, let's see how to create and send a simple text message:
  7. .. literalinclude:: ../includes/email-simple.py
  8. Here's an example of how to send a MIME message containing a bunch of family
  9. pictures that may be residing in a directory:
  10. .. literalinclude:: ../includes/email-mime.py
  11. Here's an example of how to send the entire contents of a directory as an email
  12. message: [1]_
  13. .. literalinclude:: ../includes/email-dir.py
  14. Here's an example of how to unpack a MIME message like the one
  15. above, into a directory of files:
  16. .. literalinclude:: ../includes/email-unpack.py
  17. Here's an example of how to create an HTML message with an alternative plain
  18. text version: [2]_
  19. .. literalinclude:: ../includes/email-alternative.py
  20. .. rubric:: Footnotes
  21. .. [1] Thanks to Matthew Dixon Cowles for the original inspiration and examples.
  22. .. [2] Contributed by Martin Matejek.