How to distinct between multiple Outlook Email accounts

Add-in Express™ Support Service
That's what is more important than anything else

How to distinct between multiple Outlook Email accounts
Trying to determine when a mail item actually is sent or recieved... 
Johnny Bravenboer




Posts: 13
Joined: 2006-03-20
Hi again,

I have created a COM Add-in using the Add-in Express VCL tools and Delphi 5 Professional.

The plugin works pretty well, as the add-in can automatically archive any sent Email item to a shared database.

But...

From time to time the add-in will not properly 'detect' whether a message was sent or received by the user, because the user might be using multiple Email accounts in his/her Outlook.

[SCENARIO]
When the user recieves an Email message addressed to the one of the secondairy Email accounts and clicks "reply", Outlook uses the account the Email was originly addressed to as the "From" address in the reply Email message.
[/SCENARIO]

In this scenario the coding I've used so far no longer works as the "Default" email address will be retrieved, instead of the secondairy Email address:


lvSent := (lvSenderAddress = OutlookApp.Session.CurrentUser.Address);


Would there be any other solution to determine wheter a Email message was sent?

Problems with some other solutions I came up with myself:

Solution 1:

Just mark every message that is put in the "Sent Items" as "Sent"

Problem:
When the user accidently drags a received Email messages to the "Sent Items" folder, this message will now also be detected as "Sent" by the user.

Solution 2:

lvSent := (lvSenderAddress = OutlookApp.Session.CurrentUser.Address) OR (lvSenderName = OutlookApp.Session.CurrentUser.Name);


Problem:
Names are hardly unique, while Email addresses definitly are.

Any other ideas..?

Thanks,

John... ;)
Posted 06 Dec, 2006 02:42:03 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi John,

You can try to get all email adresses from the windows registry. See the HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\<PROFILE NAME>\9375CFF0413111d3B88A00104B2A6676 registry branch. NOTE, this patch depends on Windows and Outlook versions.


P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.

Posted 06 Dec, 2006 06:37:11 Top
Johnny Bravenboer




Posts: 13
Joined: 2006-03-20
Hi again,

Thanks for the information, but the suggested solution is not exactly what I was hoping for...

So now I use a "work around" instead (which is not truly accurate, but does the job).

Basically what my plugin does now, is capture the event of items being dropped into the "Sent Items" folder and that sets a boolean flag:

ovIsSentItem := TRUE;


So now my code looks something like this:

lvSent := (lvSenderAddress = OutlookApp.Session.CurrentUser.Address) OR ovIsSentItem;


It's not the best solution as now every message being "accidently" dropped into the "Sent Items" folder will now be flagged as "Sent Item", including received messages, but in "normal" use, this should not be an issue.

Again thanks for the support,

Regards,

John... ;)
Posted 11 Dec, 2006 20:26:24 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi John,

Thank you for the information and good luck with your project.

Posted 12 Dec, 2006 04:11:38 Top