电子邮件中可点击的图像

问题描述 投票:0回答:1

我有图片和文字。我如何才能让收到电子邮件的人可以单击图像,以便将他们发送到网页?

    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
excel vba outlook href
1个回答
0
投票

您需要用

<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>
标签后无法指定任何内容。你必须保持结构。

© www.soinside.com 2019 - 2024. All rights reserved.