blob: 8702212080c144c0f6e6d1e63ea35fd0f1e990a7 [file] [log] [blame]
Guido van Rossum8b3febe2007-08-30 01:15:14 +00001# Copyright (C) 2001-2007 Python Software Foundation
2# Author: Barry Warsaw
3# Contact: email-sig@python.org
4
5"""A package for parsing, handling, and generating email messages."""
6
7__version__ = '5.0.0'
8
9__all__ = [
10 'base64mime',
11 'charset',
12 'encoders',
13 'errors',
14 'generator',
15 'header',
16 'iterators',
17 'message',
18 'message_from_file',
19 'message_from_string',
20 'mime',
21 'parser',
22 'quoprimime',
23 'utils',
24 ]
25
26
27
28# Some convenience routines. Don't import Parser and Message as side-effects
29# of importing email since those cascadingly import most of the rest of the
30# email package.
31def message_from_string(s, *args, **kws):
32 """Parse a string into a Message object model.
33
34 Optional _class and strict are passed to the Parser constructor.
35 """
36 from email.parser import Parser
37 return Parser(*args, **kws).parsestr(s)
38
39
40def message_from_file(fp, *args, **kws):
41 """Read a file and parse its contents into a Message object model.
42
43 Optional _class and strict are passed to the Parser constructor.
44 """
45 from email.parser import Parser
46 return Parser(*args, **kws).parse(fp)