0
votes

I am using Sendgrid API v3 in a node.js and express environment.

I am using email dynamic templates and easily I can send custom text to the email templates.

But I need also to add attachments and I can't find documentation about that. I need to add attachments in 2 different ways:

  1. There are email that need to have always the same attachments and it would be good for the email template to have its own attachments that is send to the customer inbox not matter what is the server data sent to sendgrid.
  2. If a clinet buys an ebook, this file should be sent by the server, together with the rest of {{{data}}} to Sendgrid and this specific file should be delivered to the client as an attachments.

Can anyone say how to add attachments this way?

Thanks

1

1 Answers

0
votes

Sendgrid attachments are limited to 30mb which might be too small for what you are trying to do. Sendgrid let's you use the digioh api to send files up to 2gb. https://digioh.com/sendgrid

An alternative solution would be to send a callback url as text in the email that is linked to an endpoint on your express server that let's users download the data. In this case you would need some additional setup to make sure only users who purchased the items can download them.