【问题标题】:How to send automatic mails from QTP (not summary !!)如何从 QTP 发送自动邮件(不是摘要!!)
【发布时间】:2016-08-14 22:12:16
【问题描述】:

所以我知道如何从 QTP 发送自动摘要邮件

但这不是我需要的那种信息,事实上我想要我的测试的 LongComments。

问题是“测试结果”邮件的内容正是我所需要的,所以这很完美,但是如何在我的测试结束时自动发送 ?

我的意思是使用 QTP 的重点是自动化,我无法自动化软件的功能之一,我在这里很困惑......

【问题讨论】:

    标签: email automation qtp


    【解决方案1】:

    如果您在测试机器上安装并登录了 Outlook 代理,则以下功能将起作用。您可能必须根据测试结果编写案例陈述。
    您还可以直接访问邮件服务器,而无需安装/登录 Outlook 代理。

    Function sendemail 
    
    Set objOutlook = CreateObject("Outlook.Application")
    Set sndmail= objOutlook.CreateItem(0)
    
    'Set properties
    sndmail.To = "abc@gmail.com"
    sndmail.CC = "abc@gmail.com; def@yahoo.com" 
    sndmail.Subject = "Sending mail"
    sndmail.Body= "Test Contents"
    sndmail.Attachments.Add("C:\Test.txt") 'Path of the file  
    'Send the mail
    sndmail.Send
    
    
    'Clear object 
    Set sndmail= Nothing
    Set objOutlook = Nothing
    
    End Function
    

    【讨论】:

      【解决方案2】:
      Function fnSendEmailFromOutlook
      
      'Create an object of type Outlook
      Set objOutlook = CreateObject("Outlook.Application")
      Set myMail = objOutlook.CreateItem(0)
      
      'Set the email properties
      myMail.To = "some_mail_id@gmail.com"
      myMail.CC = "some_mail_id_2@gmail.com; some_other_mail@yahoo.com" 'Sending mails to multiple ids
      myMail.BCC = "" 'If BCC is not required, then this line can be omitted
      myMail.Subject = "Sending mail from MS Outlook using QTP"
      myMail.Body= "Test Mail Contents"
      myMail.Attachments.Add("D:\Attachment.txt") 'Path of the file to be attached
      
      'Send the mail
      myMail.Send
      Wait(3)
      
      'Clear object reference
      Set myMail = Nothing
      Set objOutlook = Nothing
      
      End Function
      

      【讨论】:

      • 说真的,这与已经提供的答案几乎相同。
      猜你喜欢
      • 2016-10-18
      • 1970-01-01
      • 2011-12-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多