1、面向过程编程
# 面向过程编程
user_input = input('请输入角色:')
if user_input == '管理员':
import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr
msg = MIMEText('管理员,我想演男一号,你想怎么着都行。', 'plain', 'utf-8')
msg['From'] = formataddr(["李邵奇", '[email protected]'])
msg['To'] = formataddr(["管理员", '[email protected]'])
msg['Subject'] = "情爱的导演"
server = smtplib.SMTP("smtp.163.com", 25)
server.login("[email protected]", "qq1105400511")
server.sendmail('[email protected]', ['管理员', ], msg.as_string())
server.quit()
elif user_input == '业务员':
import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr
msg = MIMEText('业务员,我想演男一号,你想怎么着都行。', 'plain', 'utf-8')
msg['From'] = formataddr(["李邵奇", '[email protected]'])
msg['To'] = formataddr(["业务员", '业务员'])
msg['Subject'] = "情爱的导演"
server = smtplib.SMTP("smtp.163.com", 25)
server.login("[email protected]", "qq1105400511")
server.sendmail('[email protected]', ['业务员', ], msg.as_string())
server.quit()
elif user_input == '老板':
import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr
msg = MIMEText('老板,我想演男一号,你想怎么着都行。', 'plain', 'utf-8')
msg['From'] = formataddr(["李邵奇", '[email protected]'])
msg['To'] = formataddr(["老板", '老板邮箱'])
msg['Subject'] = "情爱的导演"
server = smtplib.SMTP("smtp.163.com", 25)
server.login("[email protected]", "qq1105400511")
server.sendmail('[email protected]', ['老板邮箱', ], msg.as_string())
server.quit()
标签:01,编程,server,面向,msg,import,com,formataddr,163
From: https://www.cnblogs.com/jhchena/p/18432395