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

posted @ 2014-03-11 15:55  赏客  阅读(198)  评论(0编辑  收藏  举报