haixin3036 发表于 2015-9-14 09:40:21

QTP:使用outlook发送邮件

  Dim objOutlook
      Dim objOutlookMsg
      Dim olMailItem
      ' Create the Outlook object and the new mail object.
      Set objOutlook = CreateObject("Outlook.Application")
      Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
      Set mapi = objOutlook.GetNameSpace("MAPI")
      ' Define mail recipients
      objOutlookMsg.To = "490010914@qq.com"
      'objOutlookMsg.CC = "my@email.com"
      ' objOutlookMsg.BCC = "my@email.com"
      ' Body of the message
      objOutlookMsg.Subject = "QTP Test Mail_kazaf"
      objOutlookMsg.Body ="hello boys"
      'Display the email
       objOutlookMsg.Display
      ' Send the message
      objOutlookMsg.Send
      ' Release the objects
      objOutlook.quit
      Set objOutlook = Nothing
      Set mapi = Nothing
页: [1]
查看完整版本: QTP:使用outlook发送邮件