Sending email with attachment - TTMSFNCCloudMicrosoftOutlookMail

Hello,

I would like to ask you about sending an email via TTMSFNCCloudMicrosoftOutlookMail with an attachment that I have in the database (not on disk).

I’m trying to use TTMSFNCCloudMicrosoftOutlookMailAttachment for this task, but every time I get an email without an attachment. On the support center, I read something about this being only for receiving emails, not sending. Can you advise me on how to do it?

Thank you for any advice

Hi,

Here is a code example that shows how to send an email with attachment via TTMSFNCCloudMicrosoftOutlookMail:

var
  NewMail: TTMSFNCCloudMicrosoftOutlookMailItem;
begin
  NewMail := TTMSFNCCloudMicrosoftOutlookMailItem.Create;
  NewMail.RecipientNames.Add('Name');
  NewMail.RecipientEmails.Add('name@domain.com');
  NewMail.Subject := 'TestMail';
  NewMail.Body := 'Bodytext';
  NewMail.Files.Add.&File := 'c:\filename.ext';

  TMSFNCCloudMicrosoftOutlookMail1.SendMessage(NewMail);
  NewMail.Free;
end;

Hello,

I have attachment in the database as VARBINARY. Do I need to save it on a disk first and then send it, as in your example? Or can I load attachment from the database and send it without saving it?

Unfortunately adding file attachments through data from memory is currently not supported. However, this is a good suggestion and we'll investigate if this feature can be added in a future version of TMS FNC Cloud Pack.