Outlook 2010 从磁盘读取一个HTML文件作为Email的Body

 
Sub ReadHTMLToMailBody()
    Dim objMailItem As Outlook.MailItem
    Dim objFileSystem As Object
    Dim objFileInfo As Object
    Dim objStream As Object
    Dim strSourceCode As String
    
    Set objMailItem = Application.CreateItem(olMailItem)
    Set objFileSystem = CreateObject("Scripting.FileSystemObject")
    Set objFileInfo = objFileSystem.GetFile("C:****\***.html")
    Set objStream = objFileInfo.OpenAsTextStream(1, -2)
    strSourceCode = objStream.ReadAll
    objMailItem.HTMLBody = strSourceCode
    objMailItem.Display
    
    Set objMailItem = Nothing
    Set objStream = Nothing
    Set objFileInfo = Nothing
    Set objFileSystem = Nothing
End Sub



欢迎访问我的主博客《 许阳的红泥屋

你可能感兴趣的:(email)