MailItemの受信者からMailAddressesを取得する
-
13-12-2019 - |
質問
私は郵便番号を知らせたのを見つける方法を見つけようとしています。次のことを考えてください。
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim mai As MailItem
Dim intInitial As Integer
Dim intFinal As Integer
Dim strEntryId As String
Dim intLength As Integer
intInitial = 1
intLength = Len(EntryIDCollection)
intFinal = InStr(intInitial, EntryIDCollection, ",")
Do While intFinal <> 0
strEntryId = Strings.Mid(EntryIDCollection, intInitial, (intFinal - intInitial))
Set mai = Application.Session.GetItemFromID(strEntryId)
intInitial = intFinal + 1
intFinal = InStr(intInitial, EntryIDCollection, ",")
Loop
strEntryId = Strings.Mid(EntryIDCollection, intInitial, (intLength - intInitial) + 1)
MsgBox strEntryId
Set mai = Application.Session.GetItemFromID(strEntryId)
For Each Recipient In mai.Recipients
MsgBox Recipient
Next
End sub
.
それらのMSGBOXでは、「John Doe」のような「いい名前」を手に入れます - しかし、私はメールアドレス「john.doe@gmail.com」を取得したいです。
これを達成するにはどうすればいいですか?
ありがとう!
解決
私はこれがOutlook 2007以降であると思います。アドレス?
For Each Recipient In mai.Recipients
MsgBox Recipient.Address
Next Recipient
.
各受信者のEメールアドレスを印刷する必要があります。
所属していません StackOverflow