Perfect solution to Archive Emails using Power Automate

When talking to a business user, he told me that his “Inbox is full” with all kinds of emails and he needs a solution to “Archive” them to PDF. He clearly mentioned that he needs a solution that is easy to configure and low on maintenance. At this point it was clear to me that the best solution to meet his requirement was Power Automate. The next task for me was to find a connector to “Convert email to PDF” which is flexible and reliable.

Table of Content

  1. Before we suggest a solution to the user, let’s answer the question “Why use archive e-mails to PDF? “
  2. Points to consider for email archival
  3. Solution
  4. Before we begin, please make sure the following prerequisites are in place
  5. Output PDF with reference to  “Attachment action” in the “Convert email to PDF” action.
Before we suggest a solution to the user, let’s answer the question “Why use archive e-mails to PDF? “
  • There’s no guarantee that a format used today, .eml or.msg file
  • Email attachments accessibility and compatibility problem. e.g. Microsoft Office 97 compatibility vs Office 2019.

Being able to access these emails, in a universally accepted format such as PDF (including PDF/A), is absolutely essential.

Before we suggest a solution to the user, let’s answer the question “Why use archive e-mails to PDF? “

  • There’s no guarantee that a format used today, .eml or.msg file
  • Email attachments accessibility and compatibility problem. e.g. Microsoft Office 97 compatibility vs Office 2019.

Being able to access these emails, in a universally accepted format such as PDF (including PDF/A), is absolutely essential.

Points to consider for email archival
  • Generates perfect-looking PDFs
    • Support for all common email content types, including HTML, RTF, plain text, and combinations of the three.
    • Conversion of rich content including in-line images and tables.
    • Support for localization of email labels such as From, To, Subject.
  • How to deal with email attachments?
  • Ignore all attachments.
    • Convert all attachments to PDF and merge them to the output PDF.
    • Convert attachments to PDF but store them in the main PDF output file as PDF attachments.
    • Convert the main file to PDF but store the attachments in their original format in the PDF.
    • Control how unsupported or corrupt attachments are dealt with
    • Broad internationalization support. A German MSG with an EML-based email l attached in Japanese.
    • Control how small images are filtered out of emails. Emails tend to have loads of small attachments (LinkedIn logo, company logos, etc).
Solution

There are a small number of solutions available in the market but only a few of them can generate PDFs the with right fidelity and deal with email attachments efficiently.

A perfect no-code solution would be to use the “Muhimbi Power Automate Connector” as it can meet the regulatory needs, generate PDFs with the right fidelity and also manage attachments efficiently.

Before we begin, please make sure the following prerequisites are in place
  • Power Automate subscription.
  • Muhimbi PDF Converter Services Online Free, full or trial subscription (Start trial).
  • Appropriate privileges to create Power Automate Flows.
  • Working knowledge Power Automate.

Step 1: For this demo, we will use the “When a new email arrives” Outlook action.

  • Folder : Inbox
  • Set the Has attachment field : No.
  • Set the Include attachments field : Yes.

Step 2: Use the “Export email” Outlook action to Export the content of the email.

  • Message-Id: “Message Id” is the output variable of the “When a new email arrives” action.

Step 3: Use the “Convert email to PDF” Muhimbi action to convert the Exported content of the email.

  • Source file name: Message Id.eml (output variable of “When a new email arrives”) action.
  • Source file content: Body (output variable of “Export email”) action.
  • Include attachments: Yes
  • Attachment action: Default(Merge)
  • Attachment summary: Yes (Display attachment name in the email header)
  • Unsupported attachment: Error (What to do with attachments which cannot be converted into PDF)
  • Include attachment filter:  No Configuration Required(Comma separated values, e.g. *.txt, June???.docx of attachments to Include).
  • Exclude attachment filter: No Configuration Required(Comma separated values, e.g. *.txt, June???.docx of attachments to Excluded).
  • Viewport size: Paper(Specify the viewport size for the conversion in pixels. E.g. 1024×768)
  • Paper size: Letter (Paper size for the output)
  • Paper size (custom): No Configuration Required(Applicable if ‘Paper size’ is set to ‘Custom’)
  • Page margins: 0.5,0.5,0.5,0.5
  • Attachment errors: No Configuration Required(How to deal with failure when converting attachments)
  • Min. image size:150(Exclude images smaller than the specified number of pixels)
  • Offline mode: No (In offline mode external resources are disabled)
  • Start page: No configuration required(The first page to include)
  • End page: No configuration required(The last page to include)
  • Conversion quality: : No Configuration Required(Quality of the output file).
  • Override settings: (Optional settings using Muhimbi’s XML syntax) – Muhimbi PDF Converter also provides some brilliant PDF/A support.  To control the PDF Version on a request by request basis we can specify the XML below in the Override settings parameters field of the “Convert email to PDF” Power Automate action.
<Override>
    <ConversionSettings>
        <!-- Set the output profile -->
        <PDFProfile>PDF_A3B</PDFProfile>
        <!-- Force post processing -->
        <OutputFormatSpecificSettings type="OutputFormatSpecificSettings_PDF">
            <FastWebView>false</FastWebView>
            <EmbedAllFonts>true</EmbedAllFonts>
            <SubsetFonts>false</SubsetFonts>
            <PostProcessFile>true</PostProcessFile>
        </OutputFormatSpecificSettings>
    </ConversionSettings>
</Override>

Step 4: Use the “Create file” OneDrive action to store the PDF document in the SharePoint document library.

  • File name: “Subject“.pdf It is the output variable of the “When a new email arrives” action.
  • File content: “Processed file content” the (output variable of the “Convert Email to PDF” )action.

That’s it, now publish the Flow and send an email containing some Word, Excel, and PowerPoint to the email address associated with the Flow. After a few moments PDFs will appear in the destination folder.

Output PDF with reference to  “Attachment action” in the “Convert email to PDF” action.

“Attachment action : Merge ” in the Convert email to PDF action.

Attachment action : Attach as PDF” in the  Convert email to PDF action.

“Attachment action : Attach as Original” in the  Convert email to PDF action.

Verify if the document is PDFA compliant using “Adobe Preflight”.

Subscribe to this blog for the latest updates about SharePoint Online, Nintex, Microsoft Flow, Power Apps, and document conversion and manipulation.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s