How to attach the PDF file from Google sheet to the email?

I want to set up n8n with ZeptoMail. I have a Google Form connected to a Google Sheet that contains PDF file links, recipient names, and email addresses. Everything is working correctly, but I need help with two things: 1. How to attach the PDF file from Google sheet to the email 2. How to send a properly formatted HTML email Please provide a step-by-step tutorial for both.

1 Like

Hi @Ansul_Maheshwari, Hi @Nifemi_Emmanuel , your idea looks solid, but is it possible that ZeptoMail would requiere it to be in Base64?

If, you can fix this without adding more nodes, simply wrapping the binary reference in your JSON body like this:

“attachments”: [{ “content”: “{{ $binary.pdf.data.toString(‘base64’) }}”, “mime_type”: “application/pdf”, “name”: “document.pdf” }]

Hey @Ansul_Maheshwari Welcome to the n8n community!

I noticed your workflow issue. The solution is fairly easy.

The PDF should be sent as Base64 in your HTTP Request node for ZeptoMail. Modify your JSON document to this.

content: $binary.pdf.data
This corresponds to the code content": "{{ $binary.pdf.data.toString('base64') }}.

That will be enough. ZeptoMail API requires the file to be in that text format.

The name pdf must tell what you set the “Binary Property” in your Google Drive node to be.

And for the HTML email, just use any AI to generate a static or maybe dynamic HTML email which will basically be a HTML syntax email for you and in the EMAIL/GMAIL node just select the HTML type and paste that HTML syntax you generated by AI and done send it and you will see a nicely formatted HTML email in your inbox!

Tell me if that suits you!

Hi @Anshul_Namdev You´re right, we are on the same page.

As a suggestion, you can also use {{ $binary.pdf.toBase64() }} which is a bit shorter and should work as well.

About the HTML, emails tend to be picky. If you paste HTML code it will maybe break the gmail or outlook. I suggest to use a css inliner tool. There are many free options online