|
因为在群发邮件时,不想让收件人看到一堆的收件人邮件地址列表,想实现单一发送的效果。但现在的问题是,邮件的正文都是一样的,能否有办法让正文部分的开头使用“Hello " & Application.GetSelectNamesDialog.recipients.name的方式。
因为邮件中有图片,使用mailitem.htmlbody,收件方看到的邮件图片是附件形式的。只有使用邮件模板才能保持正确的正文格式,但邮件正文的开头不知怎么实现个性化显示。
目前的code如下:
Sub test()
Dim oAE As Outlook.AddressEntry
Dim oAEs As Outlook.AddressEntries
Dim ol As New Outlook.Application
Dim oDialog As SelectNamesDialog
Dim newMail As Outlook.MailItem
Set oDialog = Application.Session.GetSelectNamesDialog
Set ns = ol.GetNamespace("MAPI")
oDialog.ShowOnlyInitialAddressList = True
oDialog.Display
For Each MailAddress In oDialog.Recipients
If MailAddress.AddressEntry.AddressEntryUserType = 11 Then
For Each oAE In MailAddress.AddressEntry.Members
Set newMail = ol.CreateItem(olMailItem)
Set newMail = ol.CreateItemFromTemplate("d:\mail_test.oft")
With newMail
.Subject = "Happy New Year 2015!"
.To = oAE.Address
.Send
End With
Set newMail = Nothing
Next
Else
Set newMail = ol.CreateItem(olMailItem)
Set newMail = ol.CreateItemFromTemplate("d:\mail_test.oft")
With newMail
.Subject = "Happy New Year 2015!"
.To = MailAddress
.Send
End With
Set newMail = Nothing
End If
Next
End Sub
|
|