#截取屏幕
import pyautogui
img = pyautogui.screenshot()
img.save('screenshot.png')
#发送邮件
from email.mime.text import MIMEText
from email.header import Header
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
import smtplib
from_addr = '***@qq.com'
password = '***'
smtp_server = 'smtp.qq.com'
to_addr = '***@qq.com'
msg = MIMEMultipart()
msg['From'] = from_addr
msg['To'] = to_addr
msg['Subject'] = 'HELLO, HOW IS TB TODAY!'
part = MIMEApplication(open('screenshot.png', 'rb').read())
part.add_header('Content-Disposition', 'attachment', filename='screenshot.png')
msg.attach(part)
server = smtplib.SMTP_SSL(smtp_server)
server.connect(smtp_server, 465)
server.login(from_addr, password)
server.sendmail(from_addr, [to_addr], msg.as_string())
server.quit()
owned by goodenoughcui
No comments:
Post a Comment