Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.