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:
- Log in to Email Parser by Zapier https://parser.zapier.com using your Zapier login details
- Create a mailbox, and copy its email address
- Forward an example email that you would like to extract a URL from (in my case, a Stripe receipt email)
- 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’).
- 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)
- 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”)
- 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!
PS you are correct that the file URL must be publicly accessible, and a download link, not a view link.
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:
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.
Thanks for sharing.
It’s better practice nowadays to send links to files rather then send as attachments due to factors with how attachments can cause issues