Jump to content

Creating eMail - htmpart.Body:=UniHTMLMemo1.Lines


erich.wanker

Recommended Posts

Hello..

 

i send eMails via UniGUI-app ...

 

but the FONT of the html-mail is allways  "TimesNewRomean" - the client machine is a Win8 with Outlook and all neccesary fonts installed...

 

 

In UniHTMLMemo1 - i use:

 

function afterrender(sender, eOpts)
{
sender.textareaEl.setStyle("font-family","Arial");
}
 
 
 
to send the Mail i use:
 
begin


try
                   IdSMTP := TIdSMTP.Create(nil);
                   idSMTP.Username :='xxxx@xxx.at';
                   idSMTP.Password :='xxxxx';
                   idSMTP.Host     :='smtp.xxxx';
                   idSMTP.Port     :=25;




                   Msg := TIdMessage.Create(nil);
                   Msg.From.address :='wanker@xxxx';
                   Msg.Recipients.EMailAddresses := uniedit1.Text;
                   Msg.CCList.EMailAddresses     := uniedit4.Text;
                   Msg.BccList.EMailAddresses    := uniedit3.Text;
                   Msg.Subject:= uniedit2.Text;


                   Msg.ContentType := 'multipart/mixed';
                   Msg.ClearBody;


                   while not FileExists(  mainform.attachement) do
                   begin
                    sleep(1000);
                   end;


                   TIdAttachmentFile.Create(Msg.MessageParts, mainform.attachement);




                   if UniHTMLMemo1.Lines.Text <> '' then
                   begin
                   HtmPart := TIdText.Create(Msg.MessageParts, nil );
                   HtmPart.ContentType := 'text/html';
                   htmpart.Body:=UniHTMLMemo1.Lines;                      <----- !!!!!!!!!  
                   end;




                    try
                        idSMTP.Connect();
                        idSMTP.Send(Msg);
                        ShowMessage('Message Sent -> ok');
                    except on e:Exception do ShowMessage('Message Error -> '+e.message);
                    end;
              finally
                     if idSMTP.Connected then idSMTP.Disconnect();
                     IdSMTP.Free;
                     HtmPart.Free;
                     Msg.MessageParts.Clear;


                     Msg.Free;
              end;


close;


end;

What have i forgotten? ;-)

 

ThanX for help

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...