1

I've been trying to find an answer to this within MSDN documentation and various other resources, but am unable to find something that works.

Here is some C# code I am using:

private ExtendedPropertyDefinition SurpressAutoResponse = new ExtendedPropertyDefinition(
    DefaultExtendedPropertySet.InternetHeaders, 
    "X-Auto-Response-Suppress", 
    MapiPropertyType.String);  // Also tried with StringArray and Integer

private ExtendedPropertyDefinition OtherID = new ExtendedPropertyDefinition(
    DefaultExtendedPropertySet.InternetHeaders, 
    "X-Custom-ID-Property-Example", 
    MapiPropertyType.String);

{ some other code that's unimportant in between }

var mm = new EmailMessage(Global.Exchange);
mm.ToRecipients.Add("me@me.com");  // example address, of course
mm.Subject = Subject.Replace('\r', ' ').Replace('\n', ' ');
mm.SetExtendedProperty(SurpressAutoResponse, "OOF, NDR");   // Also tried {"OOF", "NDR"} and -1     
mm.SetExtendedProperty(OtherId, "12345-1");
mm.Body = "Hello World";
mm.Send();

When I inspect the headers for the incoming email, I see that my "OtherId" is correctly set, but the X-Auto-Response-Suppress is not set. Any ideas how I should be getting exchange to suppress these out of office and delivery failure reports?

Notes:

  • I am targeting an Exchange 2010_SP2 server, which should support this

References:

UPDATE

I decided to try testing the behavior of the email and set an auto-reply/OOF on my email account. Even though the properties of the email do not include the X-Auto-Response-Suppress header, I noticed that it indeed prevented a reply. My presumption is that the header is read on the Exchange server, which also probably processes the auto-responses instead of the client. Since the client doesn't act upon the header itself, Exchange saves some data by removing it from the original email before it's transferred. Can anyone who knows please confirm this is correct?

1 Answers1

0

I have had issues using that header before as the MSDN is very vague on what all it actually does. And it is mostly only utilized by exchange servers and OOF purposes. Instead there are other headers that work better. Here is an article explaining why I think it would serve you well to use other headers. https://www.jitbit.com/maxblog/18-detecting-outlook-autoreplyout-of-office-emails-and-x-auto-response-suppress-header/

If you are only wanting to catch OOF then you can change the header to:

X-Auto-Response-Suppress:OOF

But I don't see that as a good example. Here is another thread on why this isn't always the best header to use: Detecting Outlook autoreply/out-of-office emails

mathis1337
  • 1,426
  • 8
  • 13
  • I saw that website and in my case it's an internal application and we only use Exchange. Also, my use case is that my application is sending messages/appointments from a faceless/system account and I wanted to prevent the OOF (and similar) replies that will come back in an application used by 100k people, so the X-Auto-Response-Suppress should be exactly for that purpose. That being said, the second link you posted made the think that there are likely other headers I should probably set on other automatically generated/replied messages, and I will investigate what more I can set. Thanks! – Kyle Egbert Jun 13 '20 at 21:44
  • I think you get it. Its not so much the suppress header, but the other headers that are there. I stopped using it because of this as the other headers will handle auto reply if the OOF header is not obvious. I'd give those a try and see what happens – mathis1337 Jun 13 '20 at 21:51