AdvRichEditorEmailIO: Attachments

I can easily create and send emails with embedded images using AdvRichEditorEmailIO however I would like to allow the user to also attach a file (image or pdf) to the email. Is this possible with AdvRichEditorEmailIO? I have been trying all evening without success.

All TAdvRIchEditorEMailIO does is fill the body of the message idMessage.
After TAdvRIchEditorEMailIO filled the body, you can add attachments to this same idMessage.
Sample code to add attachments is here:
https://support.embarcadero.com/article/36054

Hi Bruno,
Thank you for the suggestion, however I did find that example (and many others) yesterday and could not get it to work with the AdvRichEditorEMailIO. I tried again today just to make sure, but still with no success.
I used your Email client demo program and just added a button to select a file to be the attachment. The email works fine but there is never an attachment sent (or at least never received). This is the relevant code from the modified Email Client demo (I also tried it in various other positions in the procedure):

>   emailio := TAdvRichEditorEmailIO.Create(Self);
>   emailio.RichEditor := AdvRichEditor1;
> 
>   idMessage := TidMessage.Create(self);
>   idSmtp := TidSmtp.Create(Self);
> 
>   try
>     emailio.GenerateEmail(idmessage);
>     idMessage.Subject := edSubject.Text;
>     IdMessage.From.Address := edMailFrom.Text;
>     IdMessage.Recipients.Add.Address := edMailTo.Text;
>     IdMessage.Sender.Address := edMailFrom.Text;
> 
>     if OpenDialog1.filename <> '' then
>       Attachment := TIdAttachmentFile.Create(idMessage.MessageParts, OpenDialog1.filename);
> 
>     idsmtp.Host := edMailHost.Text;
>     Idsmtp.Connect;
>     idsmtp.Send(idMessage);
>     idsmtp.Disconnect();
>     ShowMessage('Your email was sent.');
>   finally
>     emailio.Free;
>     idSmtp.Free;
>     if OpenDialog1.filename <> '' then
>       Attachment.free;
>     idMessage.Free;
>   end;

Does it work when you leave out

emailio.GenerateEmail(idmessage);

and set the body instead yourself programmatically?

Yes, changing
emailio.GenerateEmail(idmessage);
to
IdMessage.body.Add(AdvRichEditor1.PlainText);
does send the attachment, but then of course the body is just plain text, HTML and Merge do not work.