diff options
author | Éric Araujo <merwok@netwok.org> | 2011-12-03 15:00:56 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-12-03 15:00:56 (GMT) |
commit | fe0472e7de606d5de03684ec36f7a32628f1c72d (patch) | |
tree | 50784dd73ca7bff863a84b8480405368e64cc36f /Doc/library/email.policy.rst | |
parent | 0612e8c2a25909788a8df7482670fd473e0f51ba (diff) | |
download | cpython-fe0472e7de606d5de03684ec36f7a32628f1c72d.zip cpython-fe0472e7de606d5de03684ec36f7a32628f1c72d.tar.gz cpython-fe0472e7de606d5de03684ec36f7a32628f1c72d.tar.bz2 |
Fix glitches in email.policy docs (#12208)
Diffstat (limited to 'Doc/library/email.policy.rst')
-rw-r--r-- | Doc/library/email.policy.rst | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Doc/library/email.policy.rst b/Doc/library/email.policy.rst index a77e510..d9a292c 100644 --- a/Doc/library/email.policy.rst +++ b/Doc/library/email.policy.rst @@ -48,16 +48,18 @@ file on disk and pass it to the system ``sendmail`` program on a Unix system:: >>> import email.policy >>> from subprocess import Popen, PIPE >>> with open('mymsg.txt', 'b') as f: - ... Msg = msg_from_binary_file(f, policy=email.policy.mbox) + ... msg = msg_from_binary_file(f, policy=email.policy.mbox) >>> p = Popen(['sendmail', msg['To'][0].address], stdin=PIPE) >>> g = BytesGenerator(p.stdin, policy=email.policy.SMTP) >>> g.flatten(msg) >>> p.stdin.close() >>> rc = p.wait() +.. XXX email.policy.mbox/MBOX does not exist yet + Some email package methods accept a *policy* keyword argument, allowing the 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 the platform on which it is running:: |