Charles Okwuagwu
Charles Okwuagwu

Reputation: 10876

How do i specify X-Headers for outgoing emails in Microsoft Outlook 2010

I need to include custom headers in my outgoing emails.

I'm using Microsoft Outlook 2010 and SendGrid SMTP server.

In particular, i want to specify a unique tracking ID on each mail using SendGrid's X-SMTPAPI header.

My Approach:

I am build an Outlook Add-In that will intercept outgoing emails and add the required headers Outlook.Application object has an ItemSend event that serves this purpose.

How do i use Mail.PropertyAccessor.SetProperty to set the custom headers? I am unable to find the correct header identifier that points to x-headers, or that will allow me set custom headers.

Your help is appreciated.

Thanks.

Upvotes: 2

Views: 12096

Answers (2)

Prasanta Kumar
Prasanta Kumar

Reputation: 39

I am able to add an X-header. It was tricky to find the GUID

const string SP_INTERNETHEADERS = "{00020386-0000-0000-C000-000000000046}/";
const string internetheaderSchema = "http://schemas.microsoft.com/mapi/string/" + SP_INTERNETHEADERS;
string mailproperty = internetheaderSchema + XHeader;
MailItem olmail = ThisAddIn._Application.ActiveInspector().CurrentItem;
olmail.PropertyAccessor.SetProperty(mailproperty, value);
olmail.Save();

Upvotes: 4

thims
thims

Reputation: 335

ReliefJet Essentials' Outlook rules integration allows that. You just create an outgoing rule and select ReliefJet Essentials' Set Header Value tool as a custom action. That's all!

Upvotes: 1

Related Questions