Is it possible to exceed the 999 character limit on setting an InternetHeader in an Addin for Outlook?

bram robyn 5 Reputation points
2024-07-16T14:09:26.97+00:00

For a business project, I am creating an Outlook Addin which will decode an email and check signatures after which we then add labels and so on.

I am required to send an InternetHeader with my email this way:

 item.internetHeaders.setAsync({ "Binding-Data": result }, (setHeaderResult) => {
        if (setHeaderResult.status == Office.AsyncResultStatus.Succeeded) {
          item.saveAsync(result => {
            console.log(result.value);
          })
        }
        else {
          console.log(setHeaderResult);
        }
      })

However, my header will exceed the 999 character limit in most of the cases.
Because of this limit, the header does not want to be added to the email, resulting in an error:

"Sys.ArgumentOutOfRangeException: Sys.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: Binding-Data"

However, I know it is possible to send an email with larger headers.
To test and verify this, I've created a powershell script that sends an email with my required data in the header, which goes perfectly fine, and it's possible to be read out using the Javascript API in the Addin.

I was wondering if there is the possibility to increase or disable the max character limit in the API/Addin, or if it's possible to ask a feature request for this.

Outlook
Outlook
A family of Microsoft email and calendar products.
3,973 questions
JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
994 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,963 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Michael Taylor 54,646 Reputation points
    2024-07-16T15:32:06.6266667+00:00

    This is a limit defined by the RFC5322 standard. Each line is limited to 998 or less characters and should be no more than 78 characters.

    The fact that you were able to receive (or send) a header that was larger doesn't make it legal. It is up to each client/server to determine whether it enforces the rules or not.

    The recommended workaround is to "fold" the line. Refer to the spec on this.


Your answer

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