Power Automate: Send HTML File as an Email

Power Automate: Send HTML File as an Email

Purpose

Sends the contents of a SharePoint hosted HTML file as the body of an outgoing email. Built for form letters like the new tech employee orientation letter, but works for any HTML file stored i
n the library.


Trigger Mailbox

sendhtml@geekgirlsit.com (shared mailbox). Uses the "When a new email arrives in a shared mailbox (V2)" trigger, not the standard V3 trigger, since V3 only monitors the
connected account's own inbox and cannot watch a shared mailbox.

How to Use:

Send an email to sendhtml@geekgirlsit.com with three labeled lines, one per line, in any order:
File: [folder path]/[filename].html
To: [recipient email address]
Subject: [subject line for the outgoing email]

  • Example File line: HTML letters previously stored in NYGG S3 bucket/new_tech_employee_orientation_letter.html
  • Labels (File, To, Subject) are not case sensitive.
  • The folder path is relative to the Shared Documents library on the Geek Girls IT Team Site; the flow prepends this automatically, so only the subfolder and filename need to be typed.
  • Forward slashes are the expected separator between folder and filename. Backslashes are automatically converted to forward slashes by the flow if typed out of habit.
  • Outgoing email is sent from noreply@geekgirlsit.com (shared mailbox). The account behind the Outlook "Send an email (V2)" connection must have Send As permission on this mailbox, granted in Exchange Admin Center.
  • Flow logic: reads the trigger's bodyPreview, splits it into lines using decodeUriComponent('%0A') as the newline delimiter (a literal '\n' in the expression does not work, since Power Automate treats it as two literal characters rather than an actual line break), then filters for the line starting with each label and strips the label off.
  • File retrieval: "Get file content using path" (SharePoint) with Infer Content Type enabled. Since the file is HTML (text), the action returns the content already decoded as plain text, not base64, so the Send an email Body field references the file content output directly with no base64ToString wrapper.
  • Known limitation: if a submitted email happens to contain more than one line starting with the same label (for example, a signature block that also starts with "To:"), the flow uses whichever matching line appears first. Accepted as low risk given this is a low volume internal mailbox.

  • Error Handling

    If "Get file content using path" fails, most commonly because the File path submitted does not exactly match the real SharePoint path (a stray space, typo, or wrong folder name), the flow does not just fail silently.

  • A parallel branch runs after "Get file content using path." One branch (the original) sends the HTML letter and only runs on the default "is successful" outcome. The other branch sends a failure notification and is configured, via that action's "..." menu > Run after (labeled "Configure run after" in some versions of the designer), to run on "has failed."
  • The failure notification is sent back to the original sender of the trigger email (using the trigger's From field, triggerBody()?['from']), not to a fixed address, so whoever submitted the bad path is the one who finds out and can correct it.
  • Both branches sit as siblings after "Get file content using path," added via that action's "+" icon and choosing "Add a parallel branch" (not the plain "Add an action" option), so only one of the two branches actually runs on any given execution.

      • Related Articles

      • Scheduling Email Messages Using Think Automation

        Think Automation accepts HTML files to be sent as emails. The file must be in HTML format. Cannot use Hudu docs, PDFs, etc. If unsure, it's best to test it out by sending yourself an email first. You specify the HTML file as a link. For this purpose ...
      • MailerLite Bulk Email Service

        Uses Mailerlite is used for multiple purposes: 1. To send monthly RSS newsletter (pulls RSS feed from geekgirlsit.com/blog). Contacts who confirm they want to be subscribed from the following contact forms on the geekgirlsit.com are automatically ...
      • How to Send Confidential Info Using the SecureNotes Web App

        Please note that the Hudu password link feature (using "Share Password Via Link") should be used whenever possible. When the info you are sending is not in Hudu, or for requesting information, please use the SecureNotes app as described below. Use ...
      • Send a "to do" ticket assigned to a specific tech to AutoTask via email

        Anyone with an internal email account can send a ticket from the nygeekgirls.com email to NEWTICKET@geekgirlsIT.com: The ticket subject must include the tech's first name (or in the case of a temporary employee, the employee's user name; e.g., ...
      • ThinkAutomation Triggers and Shortcuts

        Note: We're replacing this with PowerAutomate. TA Triggers are being phased out. What is ThinkAutomation? ThinkAutomation is email parsing software that runs on a virtual server in the cloud. We use it to automate repetitive administrative tasks. ...