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"
},
],
});
});