+1 vote

I'm using the MailBuilder to create an email from an existing '.eml' file but looking to add an additional custom header that isn't included in the file. Is this possible?

I've tried using AddCustomHeader but the custom header isn't added, or might be overridden after the builder is email is created from the email file?


After further reviewing the IMail documentation, I came to this which seemed to work. Please let me know if this is the best way to add a custom header the email when creating it from an '.eml' file.

Dim email As IMail = New MailBuilder().CreateFromEmlFile(emailFile)
email.Headers.Add("header name", "header value")
edited by

1 Answer

0 votes

Yes, that is the correct way of adding headers to an email:

Dim email As IMail = New MailBuilder()

email.Headers.Add("header name", "header value")

Note that custom headers should follow X- naming convention.

by (298k points)