Learning Python Network Programming
Engaging with E-mails Sending an e-mail message The smtplib module supplies us with an SMTP class, which can be initialized by a ...
Chapter 4 msg['To'] = recipient msg['From'] = sender subject = input('Enter your email subject: ') msg['Subject'] = subject mess ...
Engaging with E-mails In this example, the send_mail() function has been called by two arguments: sender and receiver. Both of t ...
Chapter 4 reply: b'250 2.0.0 OK 1414233177 hg2si4622244wib.38 - gsmtp\r\n' reply: retcode (250); Msg: b'2.0.0 OK 1414233177 hg2s ...
Engaging with E-mails msg['Subject'] = input('Enter your email subject: ') message = input('Enter your email message. Press Ente ...
Chapter 4 The summary of these responses will indicate that the server is ready to proceed with the client, as shown in the foll ...
Engaging with E-mails In the authentication phase, the authentication data is sent by the client-side script with the help of th ...
Chapter 4 Retrieving e-mails by using POP3 with poplib The stored e-mail messages can be downloaded and read by the local comput ...
Engaging with E-mails Let us see how we can read out the e-mail messages by accessing the Google's secure POP3 e-mail server. By ...
Chapter 4 Getting last message b'Received: by 10.150.139.7 with HTTP; Tue, 7 Oct 2008 13:20:42 -0700 (PDT)' b'Message-ID: fc9dd8 ...
Engaging with E-mails A typical example of what an IMAP client looks like can be seen here: mailbox = imaplib.IMAP4_SSL(<IMAP ...
Chapter 4 tmp, data = mailbox.search(None, 'ALL') for num in data[0].split(): tmp, data = mailbox.fetch(num, '(RFC822)') print(' ...
Engaging with E-mails Sending e-mail attachments In the previous section, we have seen how plain text messages can be sent by us ...
Chapter 4 part = MIMEText('text', "plain") part.set_payload(message) msg.attach(part) # attach an image in the current directory ...
Engaging with E-mails Sending e-mails via the logging module In any modern programming language, the logging facilities are prov ...
Chapter 4 self.setFormatter(logging.Formatter("%(asctime)s %(levelname)-5s %(message)s")) def flush(self): if len(self.buffer) & ...
Engaging with E-mails The output of the script discussed will be similar to the following: $ python3 logger_mail_send.py 2014-10 ...
Chapter 4 Finally, you can quit the mail program by typing the shortcut q on the command prompt, as shown here: & q Saved 1 ...
...
Interacting with Remote Systems If your computer is connected to the Internet or a local area network (LAN), then it's time to t ...
«
3
4
5
6
7
8
9
10
11
12
»
Free download pdf