Processing Email Messages in .pst, changing email addresses

Status
Not open for further replies.
A

akumar

I am trying to process .pst files with years or archived email. Many of the

email messages came from backing-up email that I received on Microsoft

Exchange servers.

As a result, many of the messages have Sender, and Recipient email addresses

stored in "EX" format.

I would like to process these .pst files and change the "EX" email addresses

to some "SMTP" like string (and change the type to "SMTP") so that I can

import into gmail.

I can locate the message, I can locate the addresses, BUT all of the

Recipient objects are read-only.

I am not trying to send email as another user, or add other users to a

message; just change the TYPE and Email Address so that the import to GMAIL

(through IMAP) works correctly.

How do I go about doing this.

As a point of reference, here is some code ... Procedure below will

recursively process folders, assume that it is called with some top level

folder. I'm looking for code to stick in the place that has the comment 'Fill

in code here ...

Public Sub ProcessFolder(ByVal pFolder As Outlook.MAPIFolder)

Dim lSubFolderList As Outlook.Folders

Dim lSubFolder As Outlook.MAPIFolder

Dim lItems As Outlook.Items

Dim lItem As Object

Dim lMailItem As Outlook.MailItem

Set lSubFolderList = pFolder.Folders

Set lSubFolder = lSubFolderList.GetFirst

Do While Not lSubFolder Is Nothing

Call ProcessFolder(lSubFolder)

Loop

Set lItems = pFolder.Items

For Each lItem In lItems

If (lItem.Class = olMail) Then

Set lMailItem = lItem

' Fill in code here ...

End If

Next

End Sub
 
K

Ken Slovak - [MVP - Outlook]

You would have to add new recipients with the desired characteristics and

remove the existing ones.

"akumar" <akumar> wrote in message

news:174AEA33-0E09-42E3-BCF7-0A702C708CD5@microsoft.com...
> I am trying to process .pst files with years or archived email. Many of the
> email messages came from backing-up email that I received on Microsoft
> Exchange servers.

> As a result, many of the messages have Sender, and Recipient email
> addresses
> stored in "EX" format.

> I would like to process these .pst files and change the "EX" email
> addresses
> to some "SMTP" like string (and change the type to "SMTP") so that I can
> import into gmail.

> I can locate the message, I can locate the addresses, BUT all of the
> Recipient objects are read-only.

> I am not trying to send email as another user, or add other users to a
> message; just change the TYPE and Email Address so that the import to
> GMAIL
> (through IMAP) works correctly.

> How do I go about doing this.

> As a point of reference, here is some code ... Procedure below will
> recursively process folders, assume that it is called with some top level
> folder. I'm looking for code to stick in the place that has the comment
> 'Fill
> in code here ...

> Public Sub ProcessFolder(ByVal pFolder As Outlook.MAPIFolder)
> Dim lSubFolderList As Outlook.Folders
> Dim lSubFolder As Outlook.MAPIFolder
> Dim lItems As Outlook.Items
> Dim lItem As Object
> Dim lMailItem As Outlook.MailItem

> Set lSubFolderList = pFolder.Folders
> Set lSubFolder = lSubFolderList.GetFirst

> Do While Not lSubFolder Is Nothing
> Call ProcessFolder(lSubFolder)
> Loop

> Set lItems = pFolder.Items
> For Each lItem In lItems
> If (lItem.Class = olMail) Then
> Set lMailItem = lItem
> ' Fill in code here ...

> End If
> Next
> End Sub
>
 
A

akumar

Awesome, I'll use that for To, CC and BCC. Can you help me with the

SenderAddress. I suspect that this technique won't work for SenderAddress.

-ak
wrote:


> You would have to add new recipients with the desired characteristics and
> remove the existing ones.

> >

>

> "akumar" <akumar> wrote in message
> news:174AEA33-0E09-42E3-BCF7-0A702C708CD5@microsoft.com...
> >I am trying to process .pst files with years or archived email. Many of the
> > email messages came from backing-up email that I received on Microsoft
> > Exchange servers.
> > As a result, many of the messages have Sender, and Recipient email
> > addresses
> > stored in "EX" format.
> > I would like to process these .pst files and change the "EX" email
> > addresses
> > to some "SMTP" like string (and change the type to "SMTP") so that I can
> > import into gmail.
> > I can locate the message, I can locate the addresses, BUT all of the
> > Recipient objects are read-only.
> > I am not trying to send email as another user, or add other users to a
> > message; just change the TYPE and Email Address so that the import to
> > GMAIL
> > (through IMAP) works correctly.
> > How do I go about doing this.
> > As a point of reference, here is some code ... Procedure below will
> > recursively process folders, assume that it is called with some top level
> > folder. I'm looking for code to stick in the place that has the comment
> > 'Fill
> > in code here ...
> > Public Sub ProcessFolder(ByVal pFolder As Outlook.MAPIFolder)
> > Dim lSubFolderList As Outlook.Folders
> > Dim lSubFolder As Outlook.MAPIFolder
> > Dim lItems As Outlook.Items
> > Dim lItem As Object
> > Dim lMailItem As Outlook.MailItem
> > Set lSubFolderList = pFolder.Folders
> > Set lSubFolder = lSubFolderList.GetFirst
> > Do While Not lSubFolder Is Nothing
> > Call ProcessFolder(lSubFolder)
> > Loop
> > Set lItems = pFolder.Items
> > For Each lItem In lItems
> > If (lItem.Class = olMail) Then
> > Set lMailItem = lItem
> > ' Fill in code here ...
> > End If
> > Next
> > End Sub
> >


>
 
K

Ken Slovak - [MVP - Outlook]

Do you mean SenderEmailAddress? That's a read-only string property, not much

you can do about that.

"akumar" <akumar> wrote in message

news:6EE6BB29-52BD-4517-8447-D1FEDF6F296E@microsoft.com...
> Awesome, I'll use that for To, CC and BCC. Can you help me with the
> SenderAddress. I suspect that this technique won't work for SenderAddress.

> -ak
 
A

akumar

Well, as it turns out, the suggestion re other recipients was also not

workable. In order to save the changes, I have to call lMailItem.Save which

promptly resets the dates on the message.
wrote:


> Do you mean SenderEmailAddress? That's a read-only string property, not much
> you can do about that.

> >

>

> "akumar" <akumar> wrote in message
> news:6EE6BB29-52BD-4517-8447-D1FEDF6F296E@microsoft.com...
> > Awesome, I'll use that for To, CC and BCC. Can you help me with the
> > SenderAddress. I suspect that this technique won't work for SenderAddress.
> > -ak


>
 
K

Ken Slovak - [MVP - Outlook]

Of course you have to save any changes to make them persistent, and that

will change dates. There's really no way to change an item in any way

without changing various date properties.

"akumar" <akumar> wrote in message

news:4219801E-0FDF-432A-A4C4-D6D266F9FC0B@microsoft.com...
> Well, as it turns out, the suggestion re other recipients was also not
> workable. In order to save the changes, I have to call lMailItem.Save
> which
> promptly resets the dates on the message.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
C Email bomb processing Outlook VBA and Custom Forms 1
C Outlook 2007 Removing then adding account restores junk email processing Using Outlook 0
T "Words In Recipient's Address" Rule Causes Outlook To Stop Processing Rules Using Outlook 3
Peter H Williams How to Move Mail item after processing Outlook VBA and Custom Forms 5
B When I add more search strings to RULES, it is not processing them Using Outlook 3
E Outlook Form - Voting Responses Not Auto Processing If Form Contains Any Code Outlook VBA and Custom Forms 0
A Processing Incoming E-mails with Macros Using Outlook 0
M Outlook 2016 Desktop - Automatic Rule Processing Using Outlook 3
K Outlook 2013 stuck "processing" when opening. Using Outlook 3
E Processing Bounced Emails Outlook VBA and Custom Forms 3
J Data Processing Using Outlook 3
A Pull mail without marking and processing, only by selecting it Using Outlook 1
L VBA Processing of Active E-Mail Message Outlook VBA and Custom Forms 2
J Outlook not processing all incoming emails Outlook VBA and Custom Forms 3
T read receipts while processing emails Outlook VBA and Custom Forms 5
J Auto processing of incoming mail Outlook VBA and Custom Forms 1
J Auto processing of incoming mail Outlook VBA and Custom Forms 1
Rupert Dragwater How to permanently remove an email address Using Outlook 9
K vba code to auto download email into a specific folder in local hard disk as and when any new email arrives in Inbox/subfolder Outlook VBA and Custom Forms 0
F Auto changing email subject line in bulk Using Outlook 2
F Want to add second email to Outlook for business use Using Outlook 3
kburrows Outlook Email Body Text Disappears/Overlaps, Folders Switch Around when You Hover, Excel Opens Randomly and Runs in the Background - Profile Corrupt? Using Outlook 0
J Outlook 365 Outlook Macro to Sort emails by column "Received" to view the latest email received Outlook VBA and Custom Forms 0
A Outlook 2019 Help with forwarding email without mentioning the previous email sender. Outlook VBA and Custom Forms 0
J Macro to send email as alias Outlook VBA and Custom Forms 0
M Shift Delete doesn't delete email from server Using Outlook 4
K Incorporate selection from combobox into body of email Outlook VBA and Custom Forms 0
L Why are some email automatically going to "archive" Using Outlook 2
M Outlook Macro to save as Email with a file name format : Date_Timestamp_Sender initial_Email subject Outlook VBA and Custom Forms 0
B Outlook 2019 Custom Email form - Edit default email form Outlook VBA and Custom Forms 6
F Add a category before "Send an Email When You Add an Appointment to Your Calendar" Outlook VBA and Custom Forms 0
T Problem when requesting to view an email in a browser Using Outlook 0
J Outlook 365 Forward Email Subject to my inbox when new email arrive in shared inbox Using Outlook 0
HarvMan Archive Email Manually Using Outlook 1
L Fetch, edit and forward an email with VBA outlook Outlook VBA and Custom Forms 2
S New Email "From" box stopped working Using Outlook 0
Rupert Dragwater Duplicate email in Folder Using Outlook 8
M "Attachment Detacher for Outlook" add in, does it update the server copy of the email? Using Outlook 1
W Outlook 365 I am getting the "Either there is no default mail client" error when I try to send an email on excel Office 365 Using Outlook 1
MattC Changing the font of an email with VBA Outlook VBA and Custom Forms 1
L Specific Incoming Email Address Immediately Deleted Using Outlook 2
Witzker Outlook 2019 Macro to send an Email Template from User Defined Contact Form Outlook VBA and Custom Forms 0
Witzker Outlook 2019 Edit contact from email does not open the user defined contactform Using Outlook 3
V Macro to mark email with a Category Outlook VBA and Custom Forms 4
R Roadrunner Email Settings | Contact Roadrunner Customer Support Outlook VBA and Custom Forms 1
D Gmail mail is being delivered to a different email inbox in Outlook App 2021 Using Outlook 2
Albert McCann Outlook 2021 Outlook Display of HTML Email from two senders is glitchy Using Outlook 0
A How Do I Setup My Optonline.Net Email Account? Outlook VBA and Custom Forms 1
H Preventing the 'email address fetch from Exchange' crashing email reading code Exchange Server Administration 0
D multiple email accounts - why do I have to choose the "from" account address?? Using Outlook 2

Similar threads

Top