Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

Send an email in plain text

(0) ShareShare
ReportReport
Posted on by 131

I've been struggling for a couple of weeks and was hoping someone might have a solution. I need to send an email in plain text only, with no HTML. The legacy system I'm working with parses data solely in plain text, and any formatting throws it off.

My current flow grabs an email, performs several actions, and then uses a compose action (payload) to format the email. The compose action correctly formats each item on a new line (Using \n), but when the email is sent, it arrives as one long paragraph. This causes the legacy system to mess up the parsing. However when reviewing the flow run itself it looks exactly how I need it. I've tried deleting the <p></p> from the html view of send an email action. I've also tried using <pre></pre> and while the line breaks are there the html email itself ruins the parsing.

Has anyone faced a similar issue or have any ideas on how to ensure the email retains its plain text formatting when sent? Any help would be greatly appreciated!


These are the instructions regarding formatting for the system

Formatting

  • Plain Text Emails Only: Web Interface parses key/value pairs from plain text emails. HTML or RTF emails will cause errors.

  • Subject Line Handling:

    • Successfully processed emails with the specified subject line will be deleted from the server.

    • Emails causing an error will be forwarded to the error email address in Mercury Administration. If forwarding fails, the email will stay on the server.

  • Error Handling: Emails without the specified subject line will be forwarded to the error email address in Administration.

  • Email Content:

    • All content should be in the body of the email, whether encrypted or not.

    • Encrypted content must be Base64 encoded with the correct line block length.

    • Attachments will be ignored.

  • Special Characters: Avoid special characters in the email except in the email address (e.g., no #, $, %, ^, &).

  • Product Fields:

    • If not using the Product Description field for a description, enter the product code in both the Product Description and Product Code fields.

  • Web Order Form Fields: Include all fields in the generated email, even if they are unused.

  • Sample should look like this:

Name: Joe Customer
Address1: 12345 Main Street
Address2:
City: Anytown
State: IL
Country: USA
Zip Code: 60515
Phone Area Code: 630
Phone Prefix: 555
Phone Number: 7890
Phone Extension: 1028
  • David_MA Profile Picture
    David_MA 8,929 on at
    Send an email in plain text
    I think you will need to contact the company that developed the system where the e-mails are being sent as I have no knowledge of it. Good luck!
  • Kamz Profile Picture
    Kamz 131 on at
    Send an email in plain text
    Yes I get the same result as you when I test to a Gmail, however it doesn't appear to be true plaintext. If you look at the email headers it looks like quoted-printable encoding. Looks like this is why when it comes into my system it replaces the \n with =0A= 

    Thoughts?
  • David_MA Profile Picture
    David_MA 8,929 on at
    Send an email in plain text
    You will need to show the configuration of your workflow. I ran the API call with the data you show and it worked:
     
     
    This was the body I used for the call:
     
    {
      "message": {
        "subject": "Plain Text Email",
        "body": {
          "contentType": "text",
          "content": "Name: Joe Customer\nAddress1: 12345 Main Street\nAddress2:\nCity: Anytown\nState: IL\nCountry: USA\nZip Code: 60515\nPhone Area Code: 630\nPhone Prefix: 555\nPhone Number: 7890\nPhone Extension: 1028."
        },
        "toRecipients": [
          {
            "emailAddress": {
              "address": "email@domain.com"
            }
          }
        ]
      },
      "saveToSentItems": "true"
    }
     
  • Kamz Profile Picture
    Kamz 131 on at
    Send an email in plain text
    Thanks David, that didn't work. I got the email to send using the graph but the data comes in as this:

    CUSTOMER NAME: John Doe=0A=
    E-MAIL ADDRESS: johndoe@example.com =0A=
    AD: 123 Main Street Apt 4=0A=
    =0A=
    AD: Springfield=0A=, MA =0A=
    DAYTIME TEL. #: (555)=0A-1234567=0A= EXT. =0A=
    NIGHT TEL. #:
    FAX #: (=0A)=0A-=0A=
    Recipient Name: Jane Doe=0A=

    Recipient Address: 123 Main street=0A=

    =0A=

     
  • Suggested answer
    David_MA Profile Picture
    David_MA 8,929 on at
    Send an email in plain text
    Try sending the e-mail through a Graph API request:
     
    POST https://graph.microsoft.com/v1.0/me/sendMail

    Body of request:

    {
      "message": {
        "subject": "Your Subject Here",
        "body": {
          "contentType": "text",
          "content": "This is the plain text content of the email."
        },
        "toRecipients": [
          {
            "emailAddress": {
              "address": "recipient@example.com"
            }
          }
        ]
      },
      "saveToSentItems": "true"
    }
     
    You can test it in the Graph API explorer at Graph Explorer | Try Microsoft Graph APIs - Microsoft Graph. It is under Outlook Mail > Send an email.
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,434

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,722

Leaderboard