Hi, we are trying to send an email with TMSFNCCloudGoogleGmail with attachments. I know how to do this with the Outlook component but the GMail component dont have the same parameters in the sendMessage function.
Can you help me?
Thansk a lot!
You can use the Files
collection to add attachments to include when sending an email.
Example:
procedure TForm1.Button1Click(Sender: TObject);
begin
TMSFNCCloudGoogleGmail1.Files.Clear;
TTMSFNCUtils.LoadFile('C:\filename.ext', DoFileLoaded);
end;
procedure TForm1.DoFileLoaded(const AFile: TTMSFNCUtilsFile);
var
m: TTMSFNCCloudGoogleGmailMessage;
begin
TMSFNCCloudGoogleGmail1.Files.Add.&File := AFile;
m := TMSFNCCloudGoogleGmail1.Mails.Add;
m.Subject := 'My Subject';
m.Body := 'My Body';
m.ToRecipients.Add('email@domain.com');
TMSFNCCloudGoogleGmail1.SendMessage(m);
end;
Hi Bart, it works fine. Thansk for your help
How do add a file without using the dialog? Our app is a service that has no user interface.
How also would I add a BLOB from a database field, without first saving that blob to a file?
Adding a file as an attachment does not require any dialog. Unfortunately, there is currently no built-in functionality to directly add a BLOB field. However, this is a good suggestion, and we will explore the possibility of expanding the attachment functionality in a future version.