Sending HTML message from Kylix - CR LF problem

Giganews Newsgroups
Subject: Sending HTML message from Kylix - CR LF problem
Posted by:  Jacco Spelt (jac…@bymysite.nl)
Date: Mon, 26 Sep 2005

Hi,

I'm trying to get my app working. I have an application sending multipart
emails. It consists of a plainttext, html part and possibly an attachment.
I'm using Kylix 3 and Indy 10. When I try to send the message I get an
error. The server is a qmail server. The error is created by the mailserver
and send via the response, it indicates that the mail is sent with bare LF
instead of CR LF's.
Qmail had the option of repairing mallformed message's but this is not
possible anymore after using TLS.

In Linux/Kylix a normal line end is indicated by a LF. So probably somewhere
in the proces it uses a LF to indicate the end of a line instead of a CR LF.
To make sure the problem is not in my input, I used simple 1 line text.

If I send it using Delphi 6 and Indy 10 using the same mailserver, there is
no problem.

I need the message to be correct, anyone an idea?

Thanx,

Jacco

My Code:
  smtpSend := TIdSMTP.Create(nil);

  msg := TIdMessage.Create(nil);
  msg.Subject:= 'Test subject';
  msg.From.Name:='test';
  msg.From.Address:='te…@test.nl';
  msg.Recipients.Add.Address:='…@address.nl';
  msg.ContentType := 'multipart/mixed';
  msg.Encoding := meMIME;

  newText:=TIdText.Create(msg.MessageParts,nil);
  newText.ContentType:='multipart/alternative';

  newText:=TIdText.Create(msg.MessageParts,nil);
  newText.ContentType:='text/plain';
  newText.ParentPart := 0;
  newText.Body.Text:='test';

  newText:=TIdText.Create(msg.MessageParts,nil);
  newText.ParentPart := 0;
  newText.ContentType:='text/html';
  newText.ContentTransfer:='7bit';
  newText.Body.Text := '<b>test</b>';

  smtpSend.Host := 'localhost';
  smtpSend.HeloName := 'localhost';
  smtpSend.Username := '…@address.nl';
  smtpSend.Password := '1234'

  smtpSend.Connect;
  smtpSend.Send(msg);
  smtpSend.Disconnect;

Replies