Skip to content

Conversation

ebeers-png
Copy link

I'd like to be able to send mail with custom headers. Currently, Messages can be initialized with header data through cloud data, but the field message_headers isn't included in the sending process. I made a simple edit to include message_headers in the data that gets sent with the post request.

To add a header to a message before sending:

message.message_headers = [{
    'name': 'X-customheader',
    'value': 'headervalue'
}]

The format of the dict is specified on this page of Microsoft's documentation, and the name must start with "X-" or "x-".

Let me know if there are other considerations to be mindful of here that I'm missing. Thanks!

@alejcas
Copy link
Member

alejcas commented Nov 11, 2022

I would like to check that this does not break a message when it's a draft that is to be sended...

Did you tried that?

Also, message_headers should respect tracking changes?
I mean you are including them always no matter if the message_headers have changed or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants