Ai
14 Star 116 Fork 75

Test云测A/interfaceTest

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
configEmail.py 1.48 KB
一键复制 编辑 原始数据 按行查看 历史
unknown 提交于 2018-12-04 10:53 +08:00 . '第二次提交'
import os
import win32com.client as win32
import datetime
import readConfig
import getpathInfo
from common.Log import logger
read_conf = readConfig.ReadConfig()
subject = read_conf.get_email('subject')#从配置文件中读取,邮件主题
app = str(read_conf.get_email('app'))#从配置文件中读取,邮件类型
addressee = read_conf.get_email('addressee')#从配置文件中读取,邮件收件人
cc = read_conf.get_email('cc')#从配置文件中读取,邮件抄送人
mail_path = os.path.join(getpathInfo.get_Path(), 'result', 'report.html')#获取测试报告路径
logger = logger
class send_email():
def outlook(self):
olook = win32.Dispatch("%s.Application" % app)
mail = olook.CreateItem(win32.constants.olMailItem)
mail.To = addressee # 收件人
mail.CC = cc # 抄送
mail.Subject = str(datetime.datetime.now())[0:19]+'%s' %subject#邮件主题
mail.Attachments.Add(mail_path, 1, 1, "myFile")
content = """
执行测试中……
测试已完成!!
生成报告中……
报告已生成……
报告已邮件发送!!
"""
mail.Body = content
mail.Send()
print('send email ok!!!!')
logger.info('send email ok!!!!')
if __name__ == '__main__':# 运营此文件来验证写的send_email是否正确
print(subject)
send_email().outlook()
print("send email ok!!!!!!!!!!")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/submi_to/interfaceTest.git
git@gitee.com:submi_to/interfaceTest.git
submi_to
interfaceTest
interfaceTest
develop

搜索帮助