This is a core "python programming (third edition)" in the third chapter example 3-4, two different types of task is created and sent E-mail messages, after the operation can't send out, don't know how to modify, another question, is the password input code does not require the sender ah, is this why? Mystery, expert advice please!
#! The/usr/bin/env python
'email - exammples. Py - demo creation of email messages'
From email. Mime. Image import MIMEImage
From email. Mime. Multipart import MIMEMultipart
From email. Mime. The text import MIMEText
The from smtplib import SMTP
SENDER='SENDER email @ 126. com'
RECIPS='recipient email @ 126. com'
SOME_IMG_FILE='a certain image. JPG # image in the current folder
# multipart the alternative: text and HTML
Def make_mpa_msg () :
Email=MIMEMultipart (' alternative ')
Text=MIMEText (' Hello World! \ r \ n ', 'plain')
Email. Attach (text)
HTML=MIMEText (
' <body> '