excel - 收件人无法在 Outlook 电子邮件中看到图像
问题描述
我在 Outlook 中发送电子邮件时无法显示图像。在我的电子邮件发送功能中,我在word文档的开头添加了一个inlineshape图片,一切都显示正常,但是当我发送电子邮件时,inline图片和我签名中的图片都消失了。请参阅下面的屏幕截图和代码。我曾尝试寻找答案但没有成功。
Sub Send_Email( _
strTo As String, _
Optional strFromEmail As String, _
Optional strSubject As String, _
Optional strCC As String, _
Optional strBCC As String, _
Optional BodyFormat As olBodyFormat = olFormatPlain, _
Optional varBody1 As Variant, _
Optional strPicturePath As String, _
Optional lngPicutreSize As Long = 100, _
Optional varBody2 As Variant, _
Optional strAttachmentPath As String, _
Optional blnSendEmail As Boolean = False)
Dim olApp As Outlook.Application
Set olApp = New Outlook.Application
Dim olEmail As Outlook.MailItem
Set olEmail = olApp.CreateItem(olMailItem)
Dim olInsp As Outlook.Inspector
Dim wdDoc As Word.document
Dim shpEmailShape As Word.InlineShape
With olEmail
.BodyFormat = BodyFormat
.display
If strFromEmail <> "" Then
.SentOnBehalfOfName = strFromEmail
End If
.To = strTo
.Subject = strSubject
.CC = strCC
.BCC = strBCC
If BodyFormat = olFormatHTML Then
If varBody2 <> "" Then
.HTMLBody = varBody2 & "<br>" & .HTMLBody
End If
If varBody1 <> "" Then
.HTMLBody = varBody1 & "<br>" & .HTMLBody
End If
ElseIf BodyFormat = olFormatRichText Then
Set olInsp = .GetInspector
Set wdDoc = olInsp.WordEditor
If IsMissing(varBody2) = False Then
varBody2.Copy
wdDoc.Range(0, 0).Paste
End If
If strPicturePath <> "" Then
Set shpEmailShape = wdDoc.Range(0, 0).InlineShapes.AddPicture(strPicturePath)
shpEmailShape.LockAspectRatio = msoCTrue
shpEmailShape.Height = lngPicutreSize
End If
If IsMissing(varBody1) = False Then
varBody1.Copy
wdDoc.Range(0, 0).Paste
End If
Else
On Error Resume Next
If varBody2 <> "" Then
.body = varBody2 & vbCrLf & .body
End If
On Error GoTo 0
On Error Resume Next
If varBody1 <> "" Then
.body = varBody1 & vbCrLf & .body
End If
On Error GoTo 0
End If
If strAttachmentPath <> "" Then
.Attachments.Add strAttachmentPath
End If
End With
If blnSendEmail = True Then
olEmail.send
End If
解决方案
听起来您确实是以 RTF 格式发送的。您需要发送带有作为附件添加并由 HTML 正文引用的图像的 HTML 格式的消息。
推荐阅读
- android - 可滚动列中隐藏在键盘后面的输入字段
- google-cloud-platform - 如何启用谷歌云存储桶警报
- java - 使用导航将参数传递给片段
- text - 如何在每一行的另一个文本之前删除文本
- laravel-backpack - 如何更改 laravel 的 webpack 的原色?
- html - 背景不会进入整个页面
- asp.net - 通过参数格式化日期
- c# - RJCP.IO.Ports SerialPortsStream System.IO.IOException - 无效配置(BreakState、Length、Position)
- flutter - Flutter 嵌套对象(基础)
- c# - .NET Core 3.1 应用程序中的 Parallel.Invoke 等价物是什么?