Dynamic PDF Attachments in Email:
Sending Files the Right Way

Everything you need to know about emails with PDF attachments

Where marketing emails aim to sell, transactional emails are there to help your customers. Help them with a request, help them with their progression, ease their minds. To do so, you sometimes need to send attachments with your emails. This article introduces you to a specific kind of attachment: The (dynamically generated) PDF file.

Written by: Tom Blijleven Published: July 10, 2020 Latest update: March 29, 2021
This article was featured on EmailVendorSelection

Why you should attach PDF attachments

Attachments come in all shapes and sizes: Office documents, HTML, calendar items, PDF files… There are about 550 different types of file types! Though attachments in emails have technical limitations, using them increases the value of your emails.

Transactional emails rely on the relationship between your recipients and your brand. These emails aim to help their recipients, and so should your attachments. They have some major advantages to your recipients. For instance they can easily save, share, edit, and review files, or import the file into another system (mostly .csv).

PDF as industry standard

The PDF format allows portability for the document, meaning it will look the same in mobile clients as in native desktop view. Fonts, images, margins et cetera. Besides, PDF files are supported by (pretty much) every device, allow interactivity within the document, and can be in designed in various shapes and sizes.

This makes PDF the de facto standard for exchanging files. Whether it’s between Google Drive and iCloud or your systems and your recipient’s inbox. It is the only format that allows both the sending and the receiving party to view the file in the exact same way – even in inbox preview.

Preview of a pdf in an inbox

In some cases, it’s better to not attach a file to your email but refer to it. For instance, when the file contains personal information, exceeds the file size limit or when the attachment is not in PDF format. In most cases, referring to the location of the file will suffice, like embedding a <hyperlink> in your email or refer to a file in the user’s login portal.

Times you shouldn't send attachments

Transactional email is the most viable way to send attachments, contrary to marketing emails. Sending PDF files with your marketing emails will do more harm than good to your deliverability. In some cases, sending PDF files is not the best idea, even with transactional email.

PDF attachments are helpful when the email has an administrative task, but do not accompany emails that are only sent to notify the recipient or let him do one simple task (click a button to reset password) with PDF files. This will only confuse the recipient and is a waste of inbox space.

The difference between triggered and dynamic PDFs

When you’re adding attachments to your emails, there basically are two ways of doing so: either via a trigger or dynamical. Triggered PDFs are the ones that must already be generated and located somewhere your email platform can find it.

Host your files on your website, Google Drive or uploaded to your platform. This way, the email platform can retrieve the PDF and send it alongside the email in a webmail, SMTP, or API process.

You're unable to alter a trigger-based PDF en route

Dynamic attachments

SMTP providers, like ourselves, generate your transactional emails when needed. Dynamically generated PDFs work the same way: PDF templates filled with the same variables as your transactional emails allow you to retrieve more data from your source systems, and create PDF attachments in your style.

Display of how dynamically generating a PDF works

When should I use trigger-based or dynamic attachments?

In the email delivery process, trigger-based attachments are the easiest solution. You generate them once and send them alongside your email in the SMTP process. Yet sometimes, trigger-based PDF attachments can be ugly and impersonal.

Dynamic attachments are great when data needs merging or an attachment needs to be hyper-personalized. Invoices, entrance tickets, and periodical reports, for example, are great for this. But dynamic PDF attachments can be hard to develop due to some technical details in XHTML. So having all your PDF attachments generated dynamically won’t pay off.

Ask yourself the following questions when considering the type of attachment to send:

  1. Is my attachment supposed to be interactive or engaging?
  2. Do I need data from multiple source systems to create the PDF?
  3. Do I need to be able to change the way my PDFs look, add logo’s, variables and/or content?

If the answers to two or three of these questions are ‘yes’, you consider dynamically generating PDFs. Obviously, you can use both trigger-based and dynamic attachments in the same email if you wish to do so.

Creating dynamic attachments (with Flowmailer)

You can create trigger-based PDFs yourself or let your CMS or invoicing system do so. Dynamic attachments, however, require a specialized platform. To create dynamic PDFs, you need to first collect the data you need. Use that data to personalize your content in an XHTML template that you convert to PDF.

Every business nowadays uses various systems to gain information about their customers. What they like, what they do, what they buy. The information they leave with you, you can use to personalize your communications.

Use data to personalize content

Once you have collected the data you need, you can personalize your content. Our previous examples already showed you what personalization can do, but there's more. Variables allow your PDFs to be unique to every recipient. Did your customer order a new pair of jeans paid by invoice? Add a link or QR code to your attachment for later payment.

Creating XHTML

Dynamic PDF files are not retrieved from a source system or an external URL, but generated in Flowmailer. XHTML gives you all the power that 'normal' Flowmailer templates also have: you can start working with variables and macros. This allows you to get much more out of your PDF attachment.

Unfortunately, XHTML to PDF has more technical limitations than normal email. So you need to be a bit more careful in your code. Some things don't work or different. Although there is no exact list of them, you can assume that fonts, lines and exact placement will not work as well. Moreover, we always recommend working in cm instead of px.

PDF generation in Flowmailer

To get started with dynamic PDF attachments, you need to arrange a few things in your Flowmailer account. Source systems from which you want to retrieve the data, for example, need to be linked to Flowmailer or accessible to retrieve data. When you create a template (Template > Type XHTML to PDF) you can retrieve that data when an email is pushed through Flowmailer.

To create a PDF template, choose XHTML to PDF

In the “Flow” of that email you can then add the PDF template as Flowstep. In this way, a dynamic PDF attachment will be added to the standard email. Of course you can also change the original message in the same Flow, without affecting the PDF attachment:

Adding the PDF as a Flowstep

Start sending dynamic PDF attachments

Dynamic PDFs in Flowmailer gives you great flexibility and increases engagement with your emails. Flowmailer PDF generation lets you take control of what you’re sending, without the hassle of complicated set ups and configuration. Experience the power of dynamic PDFs!