|Subject:||Re: How to set "Message-Id"|
|Posted by:||Remy Lebeau \(Indy Team\) (email@example.com)|
|Date:||Mon, 15 Oct 2007|
"Didier" <info.service.…@wanadoo.fr> wrote in message
> I Use Indy10.2.0.1
The current version is 10.2.3.
> I need to set "Message-Id"
That value is automatically set by the server which the message is sent
through. Clients are not supposed to set that value at all.
> to a specific value to identify my message and retrieve it
> when i receive a "non delivered mail message".
That is not what the MessageId property is meant for. Besides that, there
is no way to guaratee such a custom value gets included in the error message
anyway. The message Subject is typically the only value that gets copied
directly in the error message, and even that is not guaranteed. Some
systems will attach the original message, in which case you can use the
ExtraHeaders property to include custom values. But such attachments are
not guaranteed, either.
> Y tried "MyMsg.MsgId:=[MyId]" but it seems to be
> ignored by Indy : nothing is transmitted.
That is intentional. Again, clients are not supposed to be specifying that
value to begin with, so it is not included when sending a message. If you
must include it, then you have to use the ExtraHeaders property for it.
> Help say "MsgID is normally assigned by the server that receives the
That is correct. So it doesn't make a different if you set it or not,
because the server may overwrite it.
> In don't understand that it's impossible to set this value...
It is not impossible. It can be done via the ExtraHeaders property. But it
is not recommended.
> I tried too UID but it's the same.
Same thing. That is another server-assigned value that clients should not
be specifying manually, so it is not included in outbound messages by
default. Again, if you must use it (which you shouldn't be) then use the
ExtraHeaders property instead.
> How can i do to identify my message ?
The official and proper way to include custom values into a message is to
create your own header that is prefixed with "X-", ie:
IdMessage1.ExtraHeaders.Values['X-MyID'] := 'whatever';
If you are lucky, the server that is sending the error message may copy such
custom headers from the original message into the error message. Or may
include the original message in the error message as an attachment. But
again, neither is guaranteed.
How to set "Message-Id" posted by Didier on Mon, 15 Oct 2007