Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
(possible) bug with TIdMessageBuilderHtml
#1
First of all, thanks for the new forum. It is unclear whether the community.embarcardero.com is a replacement for forums.embarcardero.com but all I see is that community is working and forums is not. Anyway, onto the possible bug.

In the example:

Quote:with TIdMessageBuilderHtml.Create do
try
PlainText.Text := 'plain text goes here';
FillMessage(IdMessage1);
finally
Free;
end;

It says that if PlainTextCharset and PlainTextContentTransfer are not specified it uses default values. The above generates:

Quote:Content-Type: text/plain; charset=us-ascii

plain text goes here

Good so far.

If I add some Unicode stuff:

Quote:with TIdMessageBuilderHtml.Create do
try
PlainText.Text := 'äüø';
FillMessage(IdMessage1);
finally
Free;
end;

Generates:

Quote:Content-Type: text/plain; charset=utf-8

äüø

It seems to use 8bit encoding - which is good... except... Content-Transfer-Encoding: 8bit (or maybe binary) is missing as it is using 8bit content in this case.

I can fix the problem by adding PlainTextContentTransfer := '8bit' or specifying PlainTextContentTransfer := 'quoted-printable' but the problem may be the default behavior of TIdMessageBuilderHtml which should specify this automatically, yet it doesn't. I noticed though that it does so for multipart messages but not for plain-text ones.

Based on the documentation (http://www.indyproject.org/Sockets/Blogs...16.EN.aspx), it should by default use quoted-printable if nothing is specified. And that does work for multipart messages.

I also tried to set the PlainTextCharset explicitly to utf-8 and not set PlainTextContentTransfer and same problem happens and causes an issue with some servers. It is probably the best to always specify the Content-Transfer-Encoding

RFC2046 -Note that if the specified character set includes 8-bit characters and such characters are used in the body, a Content-Transfer-Encoding header field and a corresponding encoding on the data are required in order to transmit the body via some mail transfer protocols, such as SMTP [RFC-821].
Reply


Messages In This Thread
(possible) bug with TIdMessageBuilderHtml - by johnmay - 04-30-2018, 09:43 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)