Send Html Email - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Send Html Email



hi

i have this code

// mesgMessage: TidMessage
// smtpSendMail : TidSMTP

procedure TformMain.butnSendMailClick(Sender: TObject);
var
idtTextPart: TIdText;
begin
mesgMessage. Clear;
mesgMessage.ContentType := 'Multipart/Alternative';
// add a plain text message part

idtTextPart:=TIdText.Create(mesgMessage.MessageParts,nil);
idtTextPart.ContentType:='text/plain';
idtTextPart.Body.Add('This is the plain part of the message.');

// add the HTML message part

idtTextPart:= TIdText.Create(mesgMessage.MessageParts,nil);
idtTextPart.ContentType := 'text/html';
idtTextPart.Body.add('');
idtTextPart.Body.add('Testing...');
idtTextPart.Body.add('Testing...');
idtTextPart.Body.add('Testing...');
idtTextPart.Body.add('');
with mesgMessage do begin
Clear;
From.Text := Trim(editFrom.Text);
Recipients.Add.Text := Trim(editTo.Text);
Subject := Trim(editSubject.Text);
end;
with smtpSendMail do
begin
Connect;
try
Send(mesgMessage);
finally Disconnect;
end;
end;
Status('Completed');
end.

Butthe message cames in blank... what is wrong.

Thank's in advance

Marco Branco
Sign In or Register to comment.