Outlook Multiple recipients with personalized content

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

Outlook Multiple recipients with personalized content

Posts: 34
Joined: 2010-07-27

We are creating an Outlook addin. We need to implement the following scenario:
1. User sends email from Outlook to multiple recipients, including attached files
2. Each recipient receives an own email, containing a personalized link

To do this we need to cancel sending the original email, create N new emails instead (one to each of recipients), modify each of those accordingly with personalized link and send N emails. Here are some questions:
1. Is this even doable with Outlook and Addin Express?
2. Won't the UI become unstable if we start creating many emails and sending them out?
3. If above are OK - how to tackle this problem the best way?
4. Are there any special considerations regarding memory handling and releasing COM objects?
5. Can we clean up the "Sent" folder in Outlook after we send N emails, so that only the single original email (with N recipients) is added to "Sent" folder?

Best regards,
Posted 22 May, 2017 10:53:52 Top
Andrei Smolin

Add-in Express team

Posts: 15483
Joined: 2006-05-11
Hello JB,

1. It looks doable.
2. I can't tell, you'll need to test this.
3. You intercept the ItemSend event and cancel it; you'll need to use a flag to let emails created by your add-in to get sent. Cancelling the event will leave the original email open; you will need to close the corresponding inspector at some moment.

You should understand that an email you create may differ internally from a reply email and this may lead to breaking the conversation structure or other issues. Should you run into this issue, you would need to find a way through a number of [probably inter-connected] MAPI properties that constitute your email. Probably, you should create a test project to see these problems (if they exist) and then ask your detailed questions on the Outlook for Developers forum at https://social.msdn.microsoft.com/Forums/en-US/home?forum=outlookdev. I expect that your questions will attract attention of Dmitry Streblechenko - a recognized guru of MAPI internals. He should give you a final verdict.

4. All the COM objects that your add-in create should be released. The best approach is: release a COM object as soon as you don't need it any longer.

5. You can clean the Sent Items folder. You can also set a custom folder to the MailItem.SaveSentMessageFolder property; see https://msdn.microsoft.com/en-us/library/office/ff868473(v=office.15).aspx. But the original email won't be put to the Sent Items folder since you won't sent it. If you just copy it to the Sent Items folder, it may look different from other emails and thus you again would run into using/setting MAPI properties.

I wonder if my understanding is correct.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 23 May, 2017 06:21:56 Top