Share via

Graph Api Sending header X-Auto-Response-Suppress Doesnt Work

Vince Caldwell 15 Reputation points
2025-10-13T15:29:17.27+00:00

I am currently using the Graph API to send emails, but have encountered an issue. I have been trying to add the 'X-Auto-Response-Suppress' header to my emails, but it does not stop Out-Of-Office emails from being recieved in all my testing. I am using a small C# dotnet 8.0 project with the Microsoft.Graph package.

We create the message using MimeMessage. I first attempted to add it directly to the header like so...

mimeMessage.Headers.Add("X-Auto-Response-Suppress", "All")

pre-send: enter image description here

But, it never worked and the out-of-office was still received in testing.

My next approach was to add the header as an 'internetMessageHeaders' on the SendMailRequestPostBody object as such...

enter image description here

That did not work as well. How can I get suppress auto responses to work with the Graph Api sending?

<PackageReference Include="Microsoft.Graph" Version="5.55.0" />

using the following pattern for sending, then batching... User.SendMail.ToPostRequestInformation(SendMailPostRequestBody)

Microsoft Security | Microsoft Graph
0 comments No comments

2 answers

Sort by: Most helpful
  1. Michael Schmitz 1 Reputation point
    2026-03-31T08:43:12.37+00:00

    I could observe the same behavior with PowerShell and the Graph sendMail API:

        internetMessageHeaders = @(
          @{
            name = "X-Auto-Response-Suppress"
            value = "All"
          }
        )
    

    When I check the massage with my Microsoft-Account or my GMAIL-Account I cannot find the Header as part of it. So I think either Graph is filtering it out our EXO removes it bevor sending the E-Mail.

    There is another thread discussing the same problem.

    0 comments No comments

  2. iDev 0 Reputation points
    2025-11-19T15:22:54.22+00:00

    Hey Vince, hope you are keeping well.

    To suppress auto-responses like Out-Of-Office replies using the Graph API, you should add the 'X-Auto-Response-Suppress' header to the internetMessageHeaders property of the message. Here's a quick example of how to do it:

    1. Create the internetMessageHeaders list and add the header:
         var internetMessageHeaders = new List<InternetMessageHeader>  
         {  
             new InternetMessageHeader  
             {  
                 Name = "X-Auto-Response-Suppress",  
                 Value = "All"  
             }  
         };  
      
    2. Add this list to your Message object:
         var message = new Message  
         {  
             Subject = "Your Subject",  
             Body = new ItemBody  
             {  
                 ContentType = BodyType.Text,  
                 Content = "Your email content"  
             },  
             ToRecipients = new List<Recipient>  
             {  
                 new Recipient  
                 {  
                     EmailAddress = new EmailAddress  
                     {  
                         Address = "recipient@example.com"  
                     }  
                 }  
             },  
             InternetMessageHeaders = internetMessageHeaders  
         };  
      
    3. Send the message

    Regards,
    iDev

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.