File attachement not possible in email via TAdvRichEditorEmailIO?

I use this code for sending text from TAdvRichEditor via email, using Indy.

Attachement is not beeing sent. Email body is sent with no pproblem.

idmessage.From.Address:=....
IdMessage.Sender.Address := ....
dmessage.UseNowForDate:=true;
idmessage.Subject:=....
idmessage.Recipients.EMailAddresses:=....

emailio := TAdvRichEditorEmailIO.Create(Self);
emailio.RichEditor :=....

if opendialog.filename<>'' then
TIdAttachmentFile.Create(idmessage.MessageParts, opendialog.FileName);

try
emailio.GenerateEmail(idmessage);
Idsmtp.Connect;
idsmtp.Send(idMessage);
idsmtp.Disconnect;
finally
emailio.Free;
end;

Try to add the attachment AFTER the GenerateEMail call as GenerateEmail with add used images to attachments.

Thanks, that was the solution. Works perfectly now.

Regards from Norway

Ole

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.