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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...