Read Outlook Mail Item From Value

  • Thread starter Thread starter andjbird
  • Start date Start date
Status
Not open for further replies.
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.


 
The object browser (F2 in VBA) is your friend. If you used it, you'd soon
see that the MailItem object has no From property, but does have a
SenderName property.

This would be a better For ... Next loop to gather information about items
in a folder:

For Each itm in InputFolder.Items

' do stuff with the itm

If itm.UnRead = True Then

etc.

End If

However, if you plan to move or delete items, then you need to use a
down-counting loop.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
J Mail read in OWA won't appear in Outlook Exchange Server Administration 1
A How to Sort by Unread and then Read mail in Outlook 2007 Using Outlook 7
B Delete Read Receipts in Your Outlook Outlook VBA and Custom Forms 0
J Read Outlook Form fields Outlook VBA and Custom Forms 3
B Inconsistent handling of message read/unread status by Outlook Using Outlook 3
Z Outlook 365 delete reminder you can’t make change to contents of this-read only folder Using Outlook 4
R seperate read layout to design in outlook 2016..Help!! Outlook VBA and Custom Forms 3
DoctorJellybean Outlook 365 doesn't always mark emails as read Using Outlook 3
Diane Poremsky Edit and Save Outlook's Read-Only Attachments Using Outlook 0
T Outlook 2013 either fails to mark messages as read or marks them as read, then un-marks them. Using Outlook 1
Mary B Outlook 2013: Rule for copying new email to folder & marking that copy as read Using Outlook 1
JR Ryan Outlook marks all as "Read" issue Exchange Server Administration 2
T Saving Outlook 2010 email with attachments but read the email without Outlook Using Outlook 2
S Outlook Custom form - selecting text in read page Using Outlook 0
C In need of VBA code to read / parse HTML - Outlook emails Using Outlook 0
S iCloud Outlook Calendar is read only Using Outlook 1
G How to make outlook show as unread messages I read in my mobile ph or tablet Using Outlook 1
Z "Mark All as Read" in Outlook 2007 extremely slow Using Outlook 1
S Block read receipt when outlook is configured to Exchange server Using Outlook 0
P mails in my inbox of outlook 2007 tend to go missing after I read them Using Outlook 14
S How to read single instance of recursive meetings in Outlook Outlook VBA and Custom Forms 1
S How to read single instance of recursive meetings in Outlook Outlook VBA and Custom Forms 1
J Outlook 07 emails all appear READ now my Blackberry activ. Want UN BCM (Business Contact Manager) 1
V Outlook 2007: How to read/write Out-of-Office settings Outlook VBA and Custom Forms 3
R Imap read/unread problem Using Outlook 3
D Can't read some emails - text size too small. Using Outlook 2
J Increase read pane font size, but NOT image size? Using Outlook 3
S E-mails marked as read turn back to unread after a couple of seconds Using Outlook 1
M Cannot read the calendar Using Outlook 9
A Inbox didn't got read Outlook VBA and Custom Forms 0
e_a_g_l_e_p_i Is it possible it set the fonts used to read incoming mail Using Outlook 25
N Disable Auto Read Receipts sent after using Advanced Find Using Outlook 4
N Separate Read Layout Editing Outlook VBA and Custom Forms 0
A Read and Write to Text File Outlook VBA and Custom Forms 1
L Email Read and Delete Outlook VBA and Custom Forms 4
A Separate Read Layout Outlook VBA and Custom Forms 4
M Making Subject field writable (disable Read Only) Outlook VBA and Custom Forms 2
M How can I determine which user read an email Exchange Server Administration 4
Diane Poremsky Mark Sent Items as Read After Copying with a Rule Using Outlook 0
Rupert Dragwater Some mailboxes show deleted items as not read Using Outlook 5
K cant read email or open attachement Using Outlook 0
R Reply marks read message as unread Using Outlook 1
Mary B VBscript: Need to copy every email to a folder & mark that copy as read Outlook VBA and Custom Forms 5
M Sorting messages by read/unread status Using Outlook 8
C Mark all incoming emails as read Outlook VBA and Custom Forms 3
FirefIy Marking message read only if replied to the message or Ctrl+Q. Possible? Using Outlook 1
A give User Read Only access to secondary mailbox in Exchange 2010 via AD Exchange Server Administration 1
M How do I mark emails already received as read when I get a second, different email based on subject? Outlook VBA and Custom Forms 3
R Cannot read Chinese message after import Using Outlook 2
M Oh please read---> Extracting email web leads on to excel spread sheet Using Outlook 3

Similar threads

Back
Top