Sending attachment in email

Hello,
I’m trying to send an email to the user with a pdf attachment. I have created a dynamic template in sendgrid and everything’s working fine. I just don’t know how to send the file as an attachment to the email.
This is what i tried to do in cloud function :

 Moralis.Cloud.define("sendEmailToUser", function (request) {
  Moralis.Cloud.sendEmail({
    to: request.params.email,
    subject: "Test",
    templateId: "",
    dynamic_template_data: {
      name: "test User",
      message: "This is a test message",
    },
    attachments: [
      {
        content: attachment,
        filename: "test.pdf",
        type: "application/pdf",
        disposition: "attachment"
      },
    ],
  });
});

I didn’t try to send attachments before, maybe it depends on how that content is sent.

Maybe you can try with a simpler text attachment

I’m not sure if the problem is with the file. I was just wondering if there is this possibility to do it and if I’m doing it in a right way

I don’t know if you are doing it the right way or not.
Any error in dashboard in logs? does the message make it without attachment?

No error. And the email is sent properly. there is just no attachment

I don’t know how an attachment should be sent

Where did you learn or find this attachments syntax?

https://docs.sendgrid.com/api-reference/mail-send/mail-send