电子邮件上的可点击图片
Clickable image on email
我希望能够显示用户可以通过vba点击电子邮件的图片,到目前为止我有图片和文字,但我不知道如何制作,以便该人收到电子邮件的人可以单击图片,以便将他们发送到网页。
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
'OutApp.Session.logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
Fname = ThisWorkbook.Path & "\Logo.jpg"
Dim cid As String
With OutMail
.to = companymail
.Subject = "Email Title"
.Body = strBody
.HTMLBody = "<html><p>First Text</p>" & _
"<img src=""cid:Logo.jpg""height=80 width=400>" & "<html><p>Second Text </p>"
.Attachments.Add Fname, 1, 0
.Attachments.Add fileaddress
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End If
您需要用 <a>
标签包裹 <img>
标签:
<a href="URL/target.html">
<img src="src=""cid:Logo.jpg"" height=80 width=400 alt="an image" title="The title of this image" style="border-style:none"/>
</a>
此外,请记住,您需要为 HTML正文 属性 设置格式正确的 HTML 标记。这意味着您不能在关闭 <html>
标记后指定任何内容。你必须保持结构。
我希望能够显示用户可以通过vba点击电子邮件的图片,到目前为止我有图片和文字,但我不知道如何制作,以便该人收到电子邮件的人可以单击图片,以便将他们发送到网页。
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
'OutApp.Session.logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
Fname = ThisWorkbook.Path & "\Logo.jpg"
Dim cid As String
With OutMail
.to = companymail
.Subject = "Email Title"
.Body = strBody
.HTMLBody = "<html><p>First Text</p>" & _
"<img src=""cid:Logo.jpg""height=80 width=400>" & "<html><p>Second Text </p>"
.Attachments.Add Fname, 1, 0
.Attachments.Add fileaddress
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End If
您需要用 <a>
标签包裹 <img>
标签:
<a href="URL/target.html">
<img src="src=""cid:Logo.jpg"" height=80 width=400 alt="an image" title="The title of this image" style="border-style:none"/>
</a>
此外,请记住,您需要为 HTML正文 属性 设置格式正确的 HTML 标记。这意味着您不能在关闭 <html>
标记后指定任何内容。你必须保持结构。