Generating email from TAdvRichEditor with attachment

Hi,

I tried using generating e-mail from your blog example:

I just needed to add one more attachment file and I at first everything looked perfect (I was testing with old Windows live mail), but then I send the same e-mail to Outlook there attachment is not visible. As I was trying to research I guess the problem could be content type (multipart/alternative), but my understanding is not good enough to figure out what could be the problem. Can you please check also?

Kind regards,
Bostjan

While this is out of the scope of the functionality of TAdvRichEditor itself, what exact code did you use to add multiple attachments?

Hi,

This is a short variant:

procedure TForm1.Button11Click(Sender: TObject);
var emailio: TAdvRichEditorEmailIO;


begin
  emailio := TAdvRichEditorEmailIO.Create(Self);
  emailio.RichEditor := AdvRichEditor1;
  emailio.GenerateEmail(MailMessage);
  TIdAttachmentFile.Create(MailMessage.MessageParts, 'test.pdf');
  IdSMTP.Host := 'host';
  IdSMTP.Port := 25;
  idSMTP.Username:='username';
  idSMTP.Password:='password';
  MailMessage.From.Text := 'from';
  MailMessage.ReplyTo.EMailAddresses := 'from';
  MailMessage.Recipients.EMailAddresses :='email';
  MailMessage.Subject := 'Test message';
  idSMTP.Connect;
  IdSMTP.Send(MailMessage);
end;

Kind regards,
Bostjan

You can see in our code how the attachments are added:

      with TIdAttachmentFile.Create(idMessage.MessageParts, ImgPath + 'img' + i.ToString + '.png') do
      begin
        ContentID := 'image'+ i.ToString;
        ContentType := 'image/png';
        ContentDisposition := 'inline';
        ParentPart := 1;
      end;

Please use this as a guideline

Hi,

I changed by your suggestion and I'm happy to say that it worked. Thank you for your help.

Kind regards,
Bostjan