A
andjbird
I want to be able to read an Outlook Inbox mail message 'From' value to
enable me to automatically move the Inbox mail item into a corresponding
folder in the 'Personal Folder' folder. Also, if the corresponding folder
does not exist, create a folder using the senders name.
I have the following script that iterates through the items in the 'Inbox',
but I am unable to identify the senders name from the mail items as used in
the script. Does anyone have a method which I can use to proceed with this.
Private Sub Application_NewMail()
Dim InputFolder As Outlook.MAPIFolder
Set InputFolder = Application.GetNamespace("MAPI").GetDefaultFolder
(olFolderInbox)
Dim intCount As Integer
For intCount = 1 To InputFolder.Items.Count
'If InputFolder.Items(intCount).UnRead = True Then 'Read out the
unread mail in Inbox.
If InputFolder.Items(intCount).UnRead = True Then
MsgBox InputFolder.Items(intCount).Subject
MsgBox InputFolder.Items(intCount).Body
End If
Next intCount
End Sub
e.g. I have tried to reference the senders name using 'InputFolder.Items
(intCount).From', but the system does not recognise this. Also, for some
Inbox items the Debug displays that the 'InputFolder.Items(intCount)' object
does not contain any variables.
I look forward to receiving any suggestions.
enable me to automatically move the Inbox mail item into a corresponding
folder in the 'Personal Folder' folder. Also, if the corresponding folder
does not exist, create a folder using the senders name.
I have the following script that iterates through the items in the 'Inbox',
but I am unable to identify the senders name from the mail items as used in
the script. Does anyone have a method which I can use to proceed with this.
Private Sub Application_NewMail()
Dim InputFolder As Outlook.MAPIFolder
Set InputFolder = Application.GetNamespace("MAPI").GetDefaultFolder
(olFolderInbox)
Dim intCount As Integer
For intCount = 1 To InputFolder.Items.Count
'If InputFolder.Items(intCount).UnRead = True Then 'Read out the
unread mail in Inbox.
If InputFolder.Items(intCount).UnRead = True Then
MsgBox InputFolder.Items(intCount).Subject
MsgBox InputFolder.Items(intCount).Body
End If
Next intCount
End Sub
e.g. I have tried to reference the senders name using 'InputFolder.Items
(intCount).From', but the system does not recognise this. Also, for some
Inbox items the Debug displays that the 'InputFolder.Items(intCount)' object
does not contain any variables.
I look forward to receiving any suggestions.