[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版
spam Spam SPAM! This works for text, but watch what happens when we try to render a message part with truly binary data, such as ...
subclasses for all binary data types. This custom function is coded in the upcoming mailtools package of this chapter (Example 1 ...
str differentiation came online. Prior to that, the email encoder worked in Python 2.X, because bytes was really str. In 3.X, th ...
>>> m = MIMEText('abc', _charset='ascii') # pass text for ascii >>> print(m) MIME-Version: 1.0 Content-Type: t ...
“latin1” is unknown and so defaults to Base64 MIME. In fact, this is why Base64 was used for the “latin1” Unicode type earlier i ...
MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable A=E4B In fact, the ...
>>> m = Message() >>> m.add_header('Content-Type', 'text/plain') >>> m['MIME-Version'] = '1.0' >&g ...
Any way we go, some dependence on the current implementation seems unavoidable today. It seems the best we can do here, apart fr ...
In this edition, we will support Unicode encodings of text parts and headers in messages composed, and respect the Unicode encod ...
Example 13-20. PP4E\Internet\Email\pymail.py !/usr/local/bin/python """ ######################################################## ...
except: print('Error - send failed') else: if failed: print('Failed:', failed) def connect(servername, user, passwd): print('Con ...
input('[Press Enter key]') # pause after each 5 def showmessage(i, msgList): if 1 <= i <= len(msgList): print(msgList[i-1] ...
showindex(msgList) list elif command[0] == 'l': if len(command) == 1: for i in range(1, len(msgList)+1): showmessage(i, msgList) ...
There isn’t much new here—just a combination of user-interface logic and tools we’ve already met, plus a handful of new techniqu ...
First, we start the script, supply a POP password (remember, SMTP servers usually require no password), and wait for the pymail ...
Once pymail downloads your email to a Python list on the local client machine, you type command letters to process it. The l com ...
Because pymail downloads mail from your server into a local Python list only once at startup, though, we need to start pymail ag ...
Though not shown in this session, you can also send to multiple recipients, and include full name and address pairs in your emai ...
parsed and unparsed content. These interfaces, along with some user-interface magic, will lead us to full-blown email clients an ...
Example 13-21. PP4E\Internet\Email\mailtools\__init__.py """ ################################################################### ...
«
45
46
47
48
49
50
51
52
53
54
»
Free download pdf