如何在代码中添加图片? [英] How do I add an Image in my code?
本文介绍了如何在代码中添加图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Sub SendBirthdayMessage()
Dim olkContacts As Outlook.Items, _
olkContact As Object, _
olkMsg As Outlook.MailItem
Set olkContacts = Session.GetDefaultFolder(olFolderContacts).Items
For Each olkContact In olkContacts
If olkContact.Class = olContact Then
If (Month(olkContact.Birthday) = Month(Date)) And (Day(olkContact.Birthday) = Day(Date)) Then
Set olkMsg = Application.CreateItem(olMailItem)
With olkMsg
.Recipients.Add olkContact.Email1Address
'Change the subject as needed'
.Subject = "Happy Birthday " & olkContact.FirstName
'Change the message as needed'
.HTMLBody = "ICD wanted to wish you a Happy Birthday Today!!!"
'Change Display to Send if you want the messages sent automatically'
.Send
End With
End If
End If
Next
Set olkMsg = Nothing
Set olkContact = Nothing
Set olkContacts = Nothing
End Sub
推荐答案
HTML正文必须通过src:cid属性(<img src="cid:xyz">
引用图像,其中xyz是PR_INTERNET_CONTENT_ID属性的值(DASL名称
The HTML body must refer to the image through the src:cid attribute (<img src="cid:xyz">
), where xyz is the value of the PR_INTERNET_CONTENT_ID property (DASL name http://schemas.microsoft.com/mapi/proptag/0x662A001F
) set on attachment using Attachment.PropertyAccessor.SetProperty.
这篇关于如何在代码中添加图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文