Convert Email (EML, MSG files) to PDF with PDF.co using Postman

Sep 2, 2024·4 Minutes Read

In this tutorial, we will show you how to convert Email (EML, MSG files) to PDF with PDF.co using Postman. We will use a Microsoft Outlook email with 2 PDF attachments as our sample file. At the end of this tutorial, the output file will be a merged 3-pages PDF document.

Sample Source File
Sample Source File

Step 1: Setup Postman

First, open the Postman app and set up the PDF.co Postman Collection. We have an easy-to-follow step-by-step guide.

Step 2: Open PDF from Email Template

PDF From Email

Next, click the PDF from Email folder in the PDF.co API v.1.00 collection and open the POST/pdf/convert/from/email to convert PDF from email.

Step 3: Convert From Email Body Content

Now, let’s go over the /pdf/convert/from/email endpoint’s parameters.

  • The url param contains the link of the source file.
  • The embedAttachments param can be set to true or false. Set this to true to include the attachments in the final output.
  • The convertAttachments param can be set to true or false. Set this to true if you want to convert the attachments into PDF format.
  • The paperSize param allows you to customize the paper size output.
  • The name param allows you to set your desired output file name.
  • The async param can be set to true or false. Set this to true to run jobs in background (recommended for heavy documents).
  • The encrypt param can be set to true or false. Set this to true to enable encryption for output file.
PDF/Convert/From/Email Body Content


Since we are done adding all the values, let’s click the Send button to see the result.

Send Button

Here is the cURL code version.

curl --location --request POST 'https://api.pdf.co/v1/pdf/convert/from/email' \
--header 'Content-Type: application/json' \
--header 'x-api-key: YOUR_API_KEY' \
--data-raw '{
"url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/email-to-pdf/sample.eml",
"embedAttachments": true,
"convertAttachments": true,
"paperSize": "Letter",
"name": "email-with-attachments",
"async": false,
"encrypt": false
}'

Step 4: Send Result

This is our API call result. Click the link or copy and paste the URL  to view the output.

Send Result

Step 5: Source File Output

Here is the converted Microsoft Outlook email merged with its two PDF file attachments.

Sample Source File
Output

In this tutorial, you learned how to convert email (EML, MSG files) to PDF with PDF.co using Postman. You familiarized yourself with the different parameters and their functions. You also learned how to embed the email attachments and include them in the final PDF output.

Video Guide

Related Tutorials

See Related Tutorials