<filename>email_0320.py
# -*-coding:utf-8-*-

def email(p,text,subject):
    import smtplib
    from email.mime.text import MIMEText
    from email.utils import formataddr

    msg = MIMEText(text,'plain','utf-8')
    msg['From'] = formataddr(['胡杨','<EMAIL>'])
    msg['To'] = formataddr('胡杨','<EMAIL>')
    msg['Subject'] = subject

    server = smtplib.SMTP('smtp.163.com',25)
    server.login('<EMAIL>','xiaohubishen1991')
    server.sendmail('<EMAIL>',[p, ],msg.as_string())
    server.quit()

email('<EMAIL>','i love python')
<filename>email_0320.py
# -*-coding:utf-8-*-

def email(p,text,subject):
    import smtplib
    from email.mime.text import MIMEText
    from email.utils import formataddr

    msg = MIMEText(text,'plain','utf-8')
    msg['From'] = formataddr(['胡杨','<EMAIL>'])
    msg['To'] = formataddr('胡杨','<EMAIL>')
    msg['Subject'] = subject

    server = smtplib.SMTP('smtp.163.com',25)
    server.login('<EMAIL>','xiaohubishen1991')
    server.sendmail('<EMAIL>',[p, ],msg.as_string())
    server.quit()

email('<EMAIL>','i love python')
# -*-coding:utf-8-*-