[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版
Does Anybody Really Know What Time It Is? In the prior version of the smtpmail script of Example 13-19, a simple date format was ...
sockets between computers on the Net. As we’ve seen, though, the POP and SMTP interfaces in Python hide all the details. Moreove ...
email: Parsing and Composing Mail Content The second edition of this book used a handful of standard library modules (rfc822, St ...
In other words, the Message object is used both for accessing existing messages and for creating new ones from scratch. In both ...
Other combinations are possible, including some types that are not commonly seen in practice, such as message/delivery status. M ...
Basic email Package Interfaces in Action Although we can’t provide an exhaustive reference here, let’s step through a simple int ...
Handling multipart messages Making a mail with attachments is a little more work, but not much: we just make a root Message and ...
If we are sent this message and retrieve it via poplib, parsing its full text yields a Message object just like the one we built ...
might make their way into 3.2, the current sense is that fully addressing the package’s problems appears to require a full redes ...
prior to parsing; in worst cases other than email that may mandate mixed data types, the current package cannot be used at all. ...
Short of writing our own email parser, or pursuing other similarly complex approaches, the best bet today for fetched messages s ...
Specifically, the Message object’s get_payload method we used earlier accepts an op- tional decode argument to control automatic ...
Python 3.X’s sharp string types differentiation. For example, the first decode in the following refers to MIME, and the second t ...
>>> s = b'A\xe4B' >>> s.decode('latin1') 'AäB' >>> from email.message import Message >>> m = ...
support a wide variety of text types, we need to use the character-set information saved by the parser and attached to the Messa ...
though, message payload encoding is used for both international Unicode text and truly binary data such as images (as we’ll see ...
>>> parts = decode_header(S3) >>> ' '.join(abytes.decode('raw-unicode-escape' if enc == None else enc) ... for ...
though parsing won’t always work. Instead, another utility can be used to parse each address individually: getaddresses ignores ...
'"=?UTF-8?Q?Walmart?=" <
[email protected]
>, "=?UTF-8?Q?Walmart?=" <newslet
[email protected]
>' >>> pai ...
applies to the name component of email addresses, and assumes that SMTP servers will allow these to pass. This may encroach on s ...
«
44
45
46
47
48
49
50
51
52
53
»
Free download pdf