Re: indy smtpclient not sending message-id property

Giganews Newsgroups
Subject: Re: indy smtpclient not sending message-id property
Posted by:  Remy Lebeau \(Indy Team\) (re…@lebeausoftware.org)
Date: Thu, 27 May 2010

"christoph.moar" <…@alpin.it> wrote in message
news:48B32988B2B0E340…@alpin.it...

> I set a client-generated messageid property,
>
> aMessage->AddHeader("Message-ID: "+aMessageId);

Use the TIdMessage::MsgId property instead:

    aMessage->MsgId = aMessageId;

> When I send the message with
> SMTPClient->Send(aMessage);
>
> it looks like indy is not sending the message-id header (at least,
> on a test smtp server that dumps the tcp traffic, i miss that line).

That was by design.  By convention, clients do not send their own Message-ID
values to an SMTP server, the server is supposed to identify emails on its
end.  So TIdMessage::GenerateHeader() was updated in Tiburon branch revision
3434 to omit the 'Message-ID' header if the SaveToFile() method was not
being used.  Looking at RFC 2821, it allows a client to send a Message-ID,
and the server will supply one of its own only if none is present.  So,
we'll likely have to remove that restriction again.

> The problem is, I need the client to send that line, since that is
> required by an italian government backed secure email solution.
> There, the client is supposed to set the message-id, which will
> then be detected by the server, replaced with a
> server-generated-unique-one, but the client-set message-id is
> written into a x-riferimento-message-id field for later purposes.

Use the TIdMessage::ExtraHeaders property instead of the AddHeader() method.
The ExtraHeaders property is always saved and sent as-is at the end of any
headers TIdMessage generates itself.

Note that this will have a small side-effect - an 'In-Reply-To' header will
be generated as well, containing the same value as the 'Message-ID' header.

> does anybody have an idea why indy is not sending this field?

Because it was intentionally coded not to.

--
Remy Lebeau (Indy Team)

Replies

None

In response to

indy smtpclient not sending message-id property posted by christoph.moar on Thu, 27 May 2010