51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 3741|回复: 7
打印 上一主题 下一主题

[原创] 关于在QTP中自动发邮件的问题

[复制链接]

该用户从未签到

1#
发表于 2007-1-4 13:23:30 | 显示全部楼层
不知道你的程序怎么写的,假如是不定期的提示可以用场景恢复来处理,假如是每次的话,就在脚本里面控制。
发一段脚本给你参考吧:
SystemUtil.Run "C:\Program Files\Microsoft Office\Office\OUTLOOK.EXE"
wait(20)
If Dialog("Enter Password").Exist(10) Then
wait(5)
Dialog("Enter Password").Activate
Dialog("Enter Password").WinEdit("Edit").Set "user"
Dialog("Enter Password").WinEdit("Edit").Type micTab
Dialog("Enter Password").WinEdit("Edit_2").Set "domain"
Dialog("Enter Password").WinEdit("Password:").SetSecure "pwd"
Dialog("Enter Password").WinButton("OK").Click
end if
wait(5)

Set Wshshell = CreateObject("Wscript.Shell")
set mailob = createobject("outlook.application")
wait(5)
set mailitm = mailob.createitem(0)
wait(5)
mailitm.display 'this being an optional step
wait(5)
mailitm.to = "to email id"
wait(5)
mailitm.subject = "subject"
wait(5)

SRGET = "SS_SR"&Date&Time
mailitm.body = "ACT_SR_SR" & date & time
mailitm.body = "[ProductClass]" + VBCR + "Allegro Design Entry HDL" + VBCR + VBCR + "[Product]" + VBCR + "Allegro Design Entry HDL" + VBCR + VBCR + "[Version]" + VBCR + "15.5.1" + VBCR + VBCR + "[Platform]" + VBCR + "Wintel" + VBCR + VBCR + "[O/S]" + VBCR + "Win 2000" + VBCR + VBCR + "[Severity]" + VBCR + "2-Important" + VBCR + VBCR + "[AE Contact Login]" + VBCR + "2580968" + VBCR + VBCR + "[Description]" + VBCR + SRGET
myitem.attachments.add "path of the file"
mailitm.send
WshShell.sendkeys "^~"
wait(20)

Set Wshshell = CreateObject("Wscript.Shell")
Window("Microsoft Outlook").Activate
Window("Microsoft Outlook").WinTreeView("SysTreeView32").Type micCtrlDwn + micShiftDwn + "f" + micShiftUp + micCtrlUp
Window("Microsoft Outlook").Activate
Window("Advanced Find").Activate
Window("Advanced Find").WinEdit("Search for the word(s):").Set "Email List"
WshShell.sendkeys "~"
Wait(10)
Window("Microsoft Outlook").Activate
Window("Advanced Find").Maximize
Window("Advanced Find").Activate
WshShell.sendkeys "^o"
Wait(5)
Window("Message (Rich Text)").Activate
WshShell.sendkeys "^d"
Wait(5)
Window("Advanced Find").Activate
WshShell.sendkeys "%{F4}"
~~~~~~~~~~~~~~~~~~~~~
希望对你有帮助。
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-5-11 04:55 , Processed in 0.064346 second(s), 22 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表