Missing periods [again]. Can't solve the problem!

Giganews Newsgroups
Subject: Missing periods [again]. Can't solve the problem!
Posted by:  Pablo (pagg…@gmail.com)
Date: Fri, 27 Jul 2007

I am having the problem of the missing periods within the body of my HTML mails.
I have modified the code in several points following Remy Lebeau's suggestions I
have read in the forums, but the problem is still there!

I have being reading also in this newsgroup, that the problem of the "missing
periods" goes back up to year 2005 when there are posts like:
"Mystery... periods are being dropped in monetary values"
"Mystery of dropping periods solved. Need help to fix."
etc,

It seems that this is an old problem, but the solution is unclear (for me).
There is also a post from Remy Lebeau with the following code, but I don't fully
understand what is it for, and how to insert it.

    for i := 0 to ATextPart.Body.Count - 1 do begin
        with TIdEncoderQuotedPrintable.Create do try
            LData := Encode(ATextPart.Body[i] + EOL);
        finally Free; end;
        if TransferEncoding = iso2022jp then begin
            LData := Encode2022JP(LData);
        end;
        if (LData <> '') and (LData[1] = '.') then begin
            LData := '.' + LData;
        end;
        IOHandler.Write(LData);
    end;

I want to emphasize that ONLY PERIODS are missing in my e-mails, no other
characters.
Also, I have seen that there is a relationship between this problem and if the
body of the mail contains #13#10 sequences or not.
The error of the missing periods moves from one place to other ... but it is
still there.

I need a fix for this, please !!!

By the way, the Indy version I'm using is 10.1.5, and it is the last one I could
find.
I have read on some posts that there is 10.1.6 ... but where ?? Does it exist?
Does it fix this behaviour?

Thank you for any help!

My code is this:

//--------------------------------------------------------------------------------------------
// This is the main part of the SEND MAIL application
    begin
      msg.Clear;
      msg.From.Address := dmET.GetValorConfig('MAILER_EMAIL_FROM_RESULTADO');
      msg.From.Name := dmET.GetValorConfig('MAILER_NOMBRE_FROM_RESULTADO');
      msg.Recipients.EMailAddresses := sPara;
      msg.CCList.EMailAddresses := sCC;
      msg.BccList.EMailAddresses := sCCO;
      msg.Subject := sAsunto;
      msg.ContentType := 'multipart/mixed';

      txtpart := TIdText.Create(msg.MessageParts, nil);
      txtpart.ContentType := 'text/plain';
      txtpart.Body.Text := '';

      htmpart := TIdText.Create(msg.MessageParts, nil);
      htmpart.ContentType := 'text/html';
      htmpart.Body.Text := sCuerpo;

//begin code suggested by Remy Lebeau (Indy Team)
{
      LData := '';
      for i := 0 to htmpart.Body.Count - 1 do
      begin
        with TIdEncoderQuotedPrintable.Create(nil) do
        begin

          try
            LData := Encode(htmpart.Body[i] + #13#10);
          finally
            Free;
          end;

          if (LData <> '') and (LData[1] = '.') then
          begin
            LData := '.' + LData;
          end;

//          IOHandler.Write(LData);  What is this ???
        end;
      end;
}
//end code suggested by Remy Lebeau (Indy Team)

      //Send it
      smtp.Connect;
      smtp.Send(msg);
      smtp.Disconnect;
    end;

// This is the function that builds in "sCuerpo", the HTML body of the e-mail
function TMailer.ArmarReporteNormal(iCantMaxClips: integer): string;
var
  i: integer;
  sCuerpo: string;
  sBrief: string;
begin
  i := 1;

  sCuerpo :=
    '<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">' +
    '<html>' +
    '<head><title>Alert eMAIL</title>' +
    '</head>' +

    '<body>' +
    '<font face="Tahoma" size=2>' +

    '<table style="width: 500pt; cellSpacing=0 cellPadding=0 width=630
border=0">' +
    '  <tbody>' +
    '    <td>' +
    '      <span><a href="http://www.mydomain.com"><img style="width: 190px;
height: 61px"' +
    '      alt="eMailing Service" hspace=0
src="http://www.mydomain.com/es/media/logo_chico.jpg"' +
    '      border=2></a>' +
    '      </span></td>' +

  // Here the rest of the e-mail's body is constructed. Omited for simplicity.
  sCuerpo := sCuerpo + ...

  sCuerpo := sCuerpo +
    '</body>' +
    '</html>';

  Result := sCuerpo;
end;

Replies