Question

Download a document from an email link URL to use in a zap

  • 4 October 2022
  • 3 replies
  • 5506 views

Userlevel 1

I’m posting this as a solution as no one else has (as far as I could tell).

My use case is below, but this approach will work for anyone who wants to use Zapier to download a file from a URL in an email, i.e. in the email you receive, the file is NOT an attachment but is available to download via a link in the email. Using the Zapier mail parser you can grab that file and use it in zaps to do what you want with the file (e.g. forward as an attachment in an email, save to Google Drive, etc).

The basic overview is this:

Auto forward email → Email Parser by Zapier → Zap

My problem was with Stripe invoices and receipts – I want to auto-forward the invoice and receipt PDFs on to Dext as attachments in emails (Dext automates the receipts getting to my accounting software, automating much of our bookkeeping). As Stripe doesn’t attach the documents to their receipt emails, I have to manually download them and forward to Dext – which, to me, is not acceptable in 2022.

To start, you need to use Email parser by Zapier https://parser.zapier.com This is a separate, standalone app, but is built by Zapier and you can log in using your Zapier details. If you have a paid account, it’s no additional charge. It works by creating a mailbox (an email address) that you forward email to. The smart bit is that you can highlight content in emails that arrive at this mailbox, and you can get the mail parser to recognise parts of the content, for use in your zaps.

Here’s how I did it:

  1. Log in to Email Parser by Zapier https://parser.zapier.com using your Zapier login details
  2. Create a mailbox, and copy its email address
  3. Forward an example email that you would like to extract a URL from (in my case, a Stripe receipt email)
  4. Highlight the file download URL in the email that you would like the parser to ‘grab’ (Optionally, also highlight the sender/company name) and name the field sensibly so you can find it easily later, when editing a zap (e.g. ‘File Download’).
  5. Go to your email provider (e.g. gmail.com) and set up auto-forwarding for the emails you want to send to the mail parser mailbox email address from step 2. In gmail this would be a filter (settings → filters)
  6. In Zapier, create a new zap and start with the “Email Parser by Zapier” trigger (or, in mail parser on the mailboxes listing, click the link “use this app in Zapier”)
  7. Now add any action you like, and the file is accessible using the name you chose in step 4. For instance, send an email and add the file to the ‘attachments’ field. The file will be attached to the email – at least it is for Gmail (I’ve not tested this with other email services providers, but I don’t see why it would be different).

I hope this helps someone else. It should be a tutorial, and it is now!

 

 

 


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 7
Badge +14

Hi @danbrady 

Thanks for sharing.

Some notes…

  1. The file URL must be publicly accessible.
  2. The file URL must be a download link, not a view link.
  3. Email Parser by Zapier is not the most reliable/robust email parsing app.
    1. I often recommend Mailparser

 

It’s better practice nowadays to send links to files rather then send as attachments due to factors with how attachments can cause issues

  1. File size can be too large to send/receive as attachments
  2. Email providers can mark emails with attachments as junk/spam
  3. Email attachments cause mailbox sizes to bloat
Userlevel 1

Thanks, Troy. My use case is Stripe receipts and the above approach works well for receipts from three suppliers that use Stripe billing. 
 

I considered but didn’t try Mailparser as it’s a paid service, and Zapier’s service seems enough for my needs. However, I notice now that Mailparser is (currently) free for up to 30 Emails/month. So it’s worth a go. 
 

regarding your three points:

 

  1. The file size is small and not a problem. 
  2. I’ve never had an issue with emails with attachments being filtered as spam 
  3. possibly an issue for some, but I’m 17 years in and mailbox size is not an issue yet. If it becomes an issue in future, I can purge old invoice emails, no problem. 

From a bookkeeping point of view, email attachments are way better; I can automate emails from trusted suppliers so their invoices are sent to my accounting software for review. This is a non-trivial problem for me, so was worth the time building the zap. 

Userlevel 1

PS you are correct that the file URL must be publicly accessible, and a download link, not a view link.