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

发布于 2024-09-09 09:45:36 字数 519 浏览 0 评论 0原文

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

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

我几乎可以做我需要的一切:用我的数据库中的数据编写多行,通过 html 代码格式化正文,并使用链接和格式化文本。

我还需要在邮件正文中放置图像,但是 html 代码“img src =”等。不起作用,可能是因为图像位于我的电脑上并且收件人无法访问。 我需要找到一种嵌入图像的方法,就像使用 Lotus 菜单一样。 在我的意大利 Lotus Notes 7 中,有一个带有图像选项的“创建”菜单,我找到该图像,单击“确定”即可完成。

这就是我希望用我的代码做的事情,请告诉我这是可能的! :-)

提前致谢。

里卡多·巴尔迪诺蒂,意大利

While trying to use the hints in your answer at

Sending formatted Lotus Notes rich text email from Excel VBA

I could do almost everything I needed: write multiple lines with data from a database of mine, formatting the body by mean of html code, with links and formatted text.

I also need to put an image in the mail body, but the html code "img src="etc. does not work, maybe because the image is located on my pc and is not reached by the recipients.
I need to find a way to embed the image just like I would do by mean of the Lotus menus.
In my Italian Lotus Notes 7, there is a Create menu with an Image option, I find the image, click OK and it is done.

That's what I wish to do with my code, please tell me it's possible! :-)

Thanks in advance.

Riccardo Baldinotti, Italy

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

吹泡泡o 2024-09-16 09:45:36

地址为

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

问候

At the address

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

I found a solution, and now my mail body has an image in it.

Here is my code.

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

Regards

似狗非友 2024-09-16 09:45:36

在这里您可以找到完整的代码。它太大了,无法粘贴到这里,所以我只复制几行来展示这个想法:

  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

Here you can find the complete code. It's too large to paste here, so I'm copying just a few lines to show the idea:

  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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文