Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
e02abea2
Commit
e02abea2
authored
Dec 03, 2011
by
Éric Araujo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix glitches in email.policy docs (#12208)
parent
d2fd53e8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
Doc/library/email.policy.rst
Doc/library/email.policy.rst
+4
-2
No files found.
Doc/library/email.policy.rst
View file @
e02abea2
...
@@ -48,16 +48,18 @@ file on disk and pass it to the system ``sendmail`` program on a Unix system::
...
@@ -48,16 +48,18 @@ file on disk and pass it to the system ``sendmail`` program on a Unix system::
>>> import email.policy
>>> import email.policy
>>> from subprocess import Popen, PIPE
>>> from subprocess import Popen, PIPE
>>> with open('mymsg.txt', 'b') as f:
>>> with open('mymsg.txt', 'b') as f:
...
M
sg = msg_from_binary_file(f, policy=email.policy.mbox)
...
m
sg = msg_from_binary_file(f, policy=email.policy.mbox)
>>> p = Popen(['sendmail', msg['To'][0].address], stdin=PIPE)
>>> p = Popen(['sendmail', msg['To'][0].address], stdin=PIPE)
>>> g = BytesGenerator(p.stdin, policy=email.policy.SMTP)
>>> g = BytesGenerator(p.stdin, policy=email.policy.SMTP)
>>> g.flatten(msg)
>>> g.flatten(msg)
>>> p.stdin.close()
>>> p.stdin.close()
>>> rc = p.wait()
>>> rc = p.wait()
.. XXX email.policy.mbox/MBOX does not exist yet
Some email package methods accept a *policy* keyword argument, allowing the
Some email package methods accept a *policy* keyword argument, allowing the
policy to be overridden for that method. For example, the following code uses
policy to be overridden for that method. For example, the following code uses
the :meth:`email.message.Message.as_string` method of the *msg* object from the
the :meth:`
~
email.message.Message.as_string` method of the *msg* object from the
previous example and re-write it to a file using the native line separators for
previous example and re-write it to a file using the native line separators for
the platform on which it is running::
the platform on which it is running::
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment