TTMSFNCCloudMicrosoftOutlookMail sending mail with attachment

Hello,
i'm trying to send email with TTMSFNCCloudMicrosoftOutlookMail with attachment, but i didn't find the method to specify the file name to add at the message.
I've triied many way but my message comes only with the body.

Marino

Hi,

You can use the Attachments parameter of the SendMessage call to include attachments when sending an email with TTMSFNCCloudMicrosoftOutlookMail.

Example:

var
  Recipients: TStringList;
  Attachment: TTMSFNCCloudMicrosoftOutlookMailFile;
  Attachments: TTMSFNCCloudMicrosoftOutlookMailFiles;
begin
  Recipients := TStringList.Create;
  Recipients.Add('name@domain.com');

  Attachments := TTMSFNCCloudMicrosoftOutlookMailFiles.Create(nil);
  Attachment := Attachments.Add;
  Attachment.&File := 'c:\path\filename.ext';

  TMSFNCCloudMicrosoftOutlookMail1.SendMessage('Subject', 'Body', Recipients, nil, nil, mtPlainText, Attachments);

  Recipients.Free;
  Attachments.Free;

Hi,

It works perfectly :yum:
Thanks a lot

Marino

Happy to help!

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