login about faq

I’d like to add some custom headers to an email, then read them back in if I receive a bounce email.

I add a custom header to the email I send like this:

email.AddHeaderField ("XYZ-messageCode", "testcode") 
In the program that iterates the bounced emails I have this:
str = email.GetHeaderField(("“XYZ-MessageCode")

However the string is Nothing. I have changed the priority to high via the header. If I iterate through the headers, none are the ones I’ve added via AddHeaderField.

asked Sep 21 at 16:01

chilkat's gravatar image

chilkat ♦♦
11.8k316358421


You are expecting something that cannot be expected -- that the bounced email will also contain the same header (i.e. the email that comes back if the server decides to send a non-delivery notification of some sort). You have no control over what a remote mail server decides to send for a "bounce notification", or if it even decides to send anything at all. It is most likely that your custom headers will not be part of any NDR (non-delivery report) you receive, unless the mail server decides to send an entire copy of the original email in a sub-part of the NDR. In that case, you would have to identify it and parse it. Remember: there is no single "format" for bounced email. Mail servers and other programs send all sorts of ad-hoc non-delivery notifications..

link

answered Sep 21 at 16:02

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

I should also say that there are formats defined for NDR's (or MDN's) as shown here: https://www.example-code.com/csharp/emailObject_createMdn.asp

Also as shown here: https://tools.ietf.org/html/rfc3798

However, that does not mean a server will send a bounce notification in this format. It's possible, but it cannot be guaranteed, and there's no guarantee you'll get anything at all.

link

answered Sep 21 at 16:05

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×6
×5
×2

Asked: Sep 21 at 16:01

Seen: 125 times

Last updated: Sep 21 at 16:05

powered by OSQA