Skip to main content

Hello everyone,

 

I have a simple zap which triggers when someone submits google form and then It takes the sender info from the Form and generate a new pdf using pdf.co and upload that file to google drive.

After that, including this newly generated PDF, I have some other documents(pdfs) that are stored in my google drive that has to be sent as attachments in the email via SMPT, those pdfs I fetch them using (Find Multiple files by google). till there all workflow is working fine. 

 

However,  when I attach these pdfs it sends them as zip file.

For sending a single pdf it works perfectly fine.

 

I have tried several ways but not any of them worked for me except for adding the (publicly shared)download links to the body but I don’t want to include the links in the body. 

 

This is my initial workflow and I have to make similar zaps which contains multiple pdfs that needs to be send via attachment using SMTP. 

 

If someone knows how to solve this issue kindly help me. That would be a life savior for me because I’m sucked at this point. 

Thanks in advance!

You might have to use Code by Zapier and run a script to achieve this. 

You can ask AI in zapier to right the code for your desired outcome.

Write a script to handle multiple attachments. Here’s an example in Python:

python

import requests# Fetch file URLs or IDs from previous stepsfile_urls = input_dataa'file_urls'].split(',')  # Assuming file URLs are passed as a comma-separated string# Prepare attachmentsattachments =  ]for url in file_urls:    response = requests.get(url)    if response.status_code == 200:        attachments.append({            'filename': url.split('/')/-1],  # Extract filename from URL            'content': response.content        })# Output attachments for the next stepoutput = {'attachments': attachments}

This script fetches each file and prepares it as an attachment.

Map and pass the attachments output to the SMTP email action.


You might have to use Code by Zapier and run a script to achieve this. 

You can ask AI in zapier to right the code for your desired outcome.

Write a script to handle multiple attachments. Here’s an example in Python:

python

import requests# Fetch file URLs or IDs from previous stepsfile_urls = input_dataa'file_urls'].split(',')  # Assuming file URLs are passed as a comma-separated string# Prepare attachmentsattachments =  ]for url in file_urls:    response = requests.get(url)    if response.status_code == 200:        attachments.append({            'filename': url.split('/')/-1],  # Extract filename from URL            'content': response.content        })# Output attachments for the next stepoutput = {'attachments': attachments}

This script fetches each file and prepares it as an attachment.

Map and pass the attachments output to the SMTP email action.


Thank you ​@pranayshinde  for this workflow, I will try this out if it works and get back to you. However, I tried putting direct download links to the html body using anchor tag in the end and the applied some css to make them not clickable and it some how served the purpose! I put one pdf.co link to the attachment which was generated in the previous step so in this case I was able to put only one url to the attachment.

Other pdfs I just put the links to html body, this is not the correct method but for now it worked!

I will try your method also. Thank you


Reply