Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

send email from file contents

(0) ShareShare
ReportReport
Posted on by 27
Hey there, I have a simple flow that reads a file added to personal onedrive and then emails (gmail Send email V2) the contents in the message body.  It's working great but seems to be adding a lot of jump to the text from the file contents to the message body.  I've tried adding an "Initialize Variable" String step that inserts the file contents in to a string and then adding the string to the message body in the send email step but same results.
 
Example:
 
Input (file contents):
"summary": {
"table": [],
"line":  Scan result summary: alerts=0, warnings=0, infos=2, error=1"
},
"error": "Scan Aborted:
 

Input Send email (V2)
\"summary\": {\n \"table\": [],\n \"line\": \"Scan result summary: alerts=0, warnings=0, infos=2, error=1\"\n },\n \"error\": \"Scan Aborted:


I suspect I don't know how to appropriately search google for this type of issue but I'm not finding anything.  
 
Any help would be huge.  Thanks!!
  • Suggested answer
    CFernandes Profile Picture
    CFernandes 8,146 on at
    send email from file contents
     
    You can use the replace, easiest option...

    replace(replace(outputs('Compose'), '\n', ''), '\', '')
     
    Change the outputs('Compose') with your variable.
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
     

    Does this answer your question?
     

     
     
    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.
  • jgabrielson Profile Picture
    jgabrielson 27 on at
    send email from file contents
    I'm not able to share the input file here without redacting a lot of it.  But it's a basic mix of json snippet and regular text.  The email body on receipt shows a lot of "\n" and "\" added throughout.  Is there any way to strip these out of the filecontent before sending in the message body or configure the send email (V2) to not add them?
  • CFernandes Profile Picture
    CFernandes 8,146 on at
    send email from file contents
    Hey @jgabrielson Can you share the Input (file contents)
     
     
    body('InputActionName')?['summary']?['line']
     
    Or 
     
    json(body('InputActionName'))?['summary']?['line']
     
    Or
     
    json(variables('Input'))?['summary']?['line']
     
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
     

    Does this answer your question?
     

     
     
    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.
     

     

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,475

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,767

Leaderboard