首页 文章

从Excel VBA发送格式化的Lotus Notes富文本电子邮件

提问于
浏览
0

在尝试使用答案中的提示时

从Excel VBA发送格式化的Lotus Notes富文本电子邮件

我几乎可以做我需要的一切:用我的数据库中的数据写多行,用html代码格式化主体,用链接和格式化文本 .

我还需要在邮件正文中放置一个图像,但是html代码“img src =”等 . 不起作用,可能是因为图像位于我的电脑上并且收件人无法联系到 . 我需要找到一种嵌入图像的方法,就像我通过Lotus菜单一样 . 在我的意大利Lotus Notes 7中,有一个带有Image选项的Create菜单,我找到了图像,单击OK然后就完成了 .

这就是我想用我的代码做的,请告诉我这是可能的! :-)

提前致谢 .

Riccardo Baldinotti,意大利

2 回答

  • 0

    Here您可以找到完整的代码 . 它只是复制了几行来表明这个想法:

    If (bSetImages) Then
            For iImageIndex = 0 To Ubound(imageFilePaths)
    
                  ' Get the image file path and content id (cid).
                  strImagePath = Trim(imageFilePaths(iImageIndex))
                  If (strImagePath = "") Then Exit Sub
                  strImageCid = Trim(imageContentIds(iImageIndex))
                  If (strImageCid = "") Then Exit Sub
    
                  ' Get the image context type.
                  If (StrContains(strImagePath, ".", True)) Then strImageExt = Strrightback(strImagePath, ".") Else strImageExt = ""
                  Select Case Lcase(strImageExt)
                  Case "gif":      strImageType = "image/gif"
                  Case "jpg":      strImageType = "image/jpg"
                  Case Else:      strImageType = "image/gif"
                  End Select
    
                  ' Add the image part.
                  Set mimeImage = mimeBody.CreateChildEntity()
                  Set mimeImageHeader = mimeImage.CreateHeader({Content-ID})
                  Call mimeImageHeader.SetHeaderVal("<" & strImageCid & ">")
                  Call stream.Open(strImagePath)
                  Call mimeImage.SetContentFromBytes(stream, strImageType & {;name="} + strImageCid + {"}, ENC_IDENTITY_BINARY)
                  Call stream.Close()
    
            Next
      End If
    
  • 0

    在地址

    http://www-10.lotus.com/ldd/nd6forum.nsf/DateAllThreadedweb/dcbf91b97004f0af8525773e002867a9?OpenDocument

    我找到了一个解决方案,现在我的邮件正文中有一个图像 .

    这是我的代码 .

    Call stream.Open("<MY IMAGE PATH>")
    Set body = MailDoc.CreateMIMEEntity '("memo")
    Set richTextHeader = body.CreateHeader("Content-Type")
    Call richTextHeader.SetHeaderVal("multipart/mixed")
    Set mimeImage = body.CreateChildEntity()
    strImageType = "image/jpeg" 'Other formats are "image/gif" "image/bmp"
    Call mimeImage.SetContentFromBytes(stream, strImageType, ENC_IDENTITY_BINARY)
    Call stream.Close
    

    问候

相关问题