SendGrid

I can succsessfully send an email using SendGrid and the SendGrid demo.

But how can I attach a Pdf file to the email?

I can see there is a TMSFNCCloudSendGrid1.Template.Attachments.... But from here I'm lost.

Regards
Ole

Hi,

You can use the something like the following snippet:

  if OpenDialog1.Execute then
  begin
     TMSFNCCloudSendGrid1.Template.AddAttachment(OpenDialog1.Files[0])
  end;

Hope this helps.

Hi Bradly

The program cannot find the attacment file.

Project Project1.exe raised exception class EFOpenError with message 'Cannot open file "C:\Users\oleek\Documents\Embarcadero\Studio\Projects\Win32\Debug\C".

It always looks for the attachmentfile in the debug directory, even though I point to a valid file using the open dialog.

if opendialog1.execute then
begin
s:=opendialog1.FileName;
showmessage(s); // Shows the correct path here
TMSFNCCloudSendGrid1.Template.AddAttachment(s[1]); // Error, cannot find the file
end;

What am I doing wrong?

Kind regards,
Ole

Solved now and can send attachement succsessfully.

Please add file attacments to the demo :grinning:

Would have saved me a few hours.

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