我有图片和文字。我如何才能让收到电子邮件的人可以单击图像,以便将他们发送到网页?
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
您需要用
<img>
标签包裹 <a>
标签:
<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>
另外,请记住,您需要为 HTMLBody 属性设置格式良好的 HTML 标记。这意味着您在关闭
<html>
标签后无法指定任何内容。你必须保持结构。