Send richedit email with ipworks

Good afternnon to all,
in one of yours blog you teach how is possible send a richedit email (with or without attachment) with only one code line.
In the demo the componet used is TAdvRichEditorEmailIO that has a procedure defined as

GenerateEmail(idMessage: TIdMessage; ImgPath: string = ''); virtual;

Now, it's possible have the same procedure that works with ipworks component (TipwHTMLMailer or TipwSMTP ) and not only for indy ?

Thank you for reply

Best regards

Daniele

PS: ipWorks is delivered with delphi 10.4 and delphi 11 with getit

We will need to allocate time for this.
Add this as a feature request TMS Software | Support and when there is demand, we'll look at it.

Hi Bruno,
using ipWorks library send an emial with rich text (with embedded image(s)) and attached file is very very easy.
Not with only one code line but .... not complex.
In case someone has my need here the part of code needed to do this:
Assuming to have a TAdvRichEditor, TAdvRichEditorHTMLIO and TipwHTMLMailer (ipWorks component).

When the Send button is pressed this is the code:

// Save rich text (html text) to a file
TAdvRichEditorHTMLIO.Save(FileName);
// Load Text file to a string list
TStringList.LoadFromFile(FileName)
// Copy the stringlist text to a string 
S:=TStringList.Text;
// For this component The string "file:// " must be removed
 while Pos('file://',S)>0 do
      delete(HtmlS,Pos('file://',S),length('file://'));
// Set the new string and save again
TStringList.Rext:=S;
TStringList.SaveToFile(FileName);

// Setting htmlMailer With name and so on ...
TipwHTMLMailer.MailServer:=SMTP MailServer;
TipwHTMLMailer.MailPort:=SMTP Port;
TipwHTMLMailer.User:=Server UserName;
TipwHTMLMailer.Password:=Server Password
TipwHTMLMailer.From:=From;
TipwHTMLMailer.SendTo:=To;
TipwHTMLMailer.Subject:=Subjectt;

// IMPORTANT This must be ''
TipwHTMLMailer.MessageHTML:='';
// Because with this line the html file is loaded and
// MessageHTML is filled with the appropriate string.
// If is not empty, the file is APPEND to MessageHTML
TipwHTMLMailer.HTMLFile:= FileName;

// In case of attachment what is need is the full filename
// this can be done with a StringList
If TStringList.Count>0 then
Begin
   For I:=0 To TStringList.Count - 1 Do
         TipwHTMLMailer.AddAttachment(TStringList.String[I]);
End; 

// Send all ....
TipwHTMLMailer.Send;

// Done ...

This can be optimized (write in better code).

Hope this can be useful.

Best regards

Daniele

1 Like