通过VBA的SMTP Outlook地址



我试图通过VBA在Outlook 2007中检索一组电子邮件的SMTP地址。我需要发件人提供完整的SMTP地址。该地址主要来自EXCHANGE 2007服务器。

我有smtp地址test@something.co.uk;test1@something.co.uk;test3@somthing.co.uk在另一个表中,该表将电子邮件地址查找到另一个字段。

我需要使用来自电子邮件的SMTP地址来执行对字段的查找。

执行storename = mItem时。我得到一个x400地址,但我需要SMTP地址。肯定有办法解决这个问题。我不想用救赎。我希望有人能提供一个答案。

谢谢H

试试下面的代码,尽管

在2010年忙着使用
Sub Test()
Dim appOutlook As Outlook.Application
Dim nsOutlook As Outlook.Namespace
Dim cfOutlook As Outlook.Folder
Dim ifOutlook As Outlook.Folder
Dim x  As Long
Dim y As Long
'Create a new instance of the Outlook application.
'Set the Application object as follows:
Set appOutlook = New Outlook.Application
'use the GetNameSpace method to instantiate (ie. create an instance)
'a NameSpace object variable, to access existing Outlook items.
'Set the NameSpace object as follows:
Set nsOutlook = appOutlook.GetNamespace("MAPI")
'assign the object variable cfOutlook to the default Contacts folder:
Set cfOutlook = nsOutlook.GetDefaultFolder(olFolderContacts)
MsgBox cfOutlook
'assign the object variable ifOutlook to the default Inbox folder:
Set ifOutlook = nsOutlook.GetDefaultFolder(olFolderInbox)
MsgBox ifOutlook

y = nsOutlook.Accounts.Count
MsgBox y
For x = 1 To y
MsgBox nsOutlook.Accounts(x)
MsgBox nsOutlook.Accounts.Item(x).SmtpAddress
Next x
End Sub

最新更新