I´ve seen this plugin by @iamsalar in the plugin page and I was wondering if this is useful for sending an invoice in PDF. Right now I´m letting users to download the invoice in PDF with the selectPDF plugin but I don´t know how to send the invoice attached in an email.
There’s not many options as far generating .pdf files go, but I can personally see two ways of sending .pdf files (or attachments in general) for use-cases like invoices and receipts via SendGrid.
Linked Attachment
You can take advantage of SendGrid’s substitution tags and set one of the included tags to the location of your attachment. Keep in mind that this method won’t register as an attachment in the email, plus it’d be in your best interest to include a button or visible link in your email to them so recipients know where to click to do what.
Encoded Attachment
SendGrid supports including attachments via certain parameters sent with the request to the Mail API. The filename, type and more can also be set for each attachment, with the maximum allowable email size of 30MB. For the content of the attachment (this being the attachment itself), it must be base64 encoded which would involve some play with Bubble’s :encoded in base64 module. This seems like a great feature to have, so I’ll add it to our queue to see if it’s possible.
When creating your workflow, use the ‘Send email with attachments’ module to send up to 3 attachments in one email. For each attachment, you must set the content parameter to be your file encoded in Base64 and the filename parameter to be your file’s name and extension. Your email’s total size must not exceed 30MB.
That´s great. So for example if I generate an invoice in PDF through the SelectPDF plugin, then I can configure the Sendgrid plugin to send this invoice that is stored somewhere (I´ve the URL) to a client by email?
It seems as though the Base64 recorder module needs a file object, so as long as you have it somewhere accessible, it will be fetched and encoded for you. Give the Bubble team a shout if you run into issues.
This is awesome, it works but I´ve a problem now. It was working for a few minutes till I got this error message. I´ve tried creating another API Key but I´m still getting the same error.
> Error connecting to SendGrid API - Send email with 1 attachment: {"errors":[{"message":"Bad Request","field":null,"help":null}]}
Best way to get help is to give me a shout directly so we can take it from there. We didn’t push any updates to the plugin so it may just be a formatting error in your request as SendGrid didn’t send you their usually-included link to the relevant help docs. As far as variables go, not all must be set prior to use.
Our use case has mostly been front-end requests where the file object is coming from the File Uploader component. We had our go at AWS specifically but haven’t poured enough resources there just yet.
hi @ryanck, I’m running into this error too (bad request). Were you able to solve it? If so, is there any chance you could share a screen shot of your API call? I feel like I’m missing something teeny and it’s driving me nuts!
I am like andrews6 and I have sent to you a direct email at [email protected] since 4 days as it looks to be the best way. Have you received it ?
I would really appreciate your help to figure out this bug cause I can’t move on any further on my app while it won’t be fixed.