web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / I want to remove "\n" ...
Power Automate
Answered

I want to remove "\n" from my email body

(0) ShareShare
ReportReport
Posted on by 258

I want to remove "\n" from my email body firstly I Added my email body in Compose action and the added that compose output to Send an email(V2) I had tried initialize variable with space in value and then replace action after the compose action of my email but still I am not able to clear \n from my email.

 

  
replace('Compose'_9, variables( ' NewLine ' ),'')
 
 
Emaillll.png
Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,505 Most Valuable Professional on at

    Hi @B8,

     

    Looks like there are some typos in your expression. 

     

    Can you try the below

    replace(outputs('Compose_9'), variables('NewLine'),'')

     

    If that still does not work can you change the variable to a decodeuricomponent function

    replace(outputs('Compose_9'), decodeUriComponent('%0A'),'')
  • Verified answer
    B8 Profile Picture
    258 on at

    its showing this error when i added your both the code in Compose 27

     

    Unable to process template language expressions in action 'Compose_27' inputs at line '0' and column '0': 'The template language function 'replace' expects its first parameter 'string' to be a string. The provided value is of type 'Array'. Please see https://aka.ms/logicexpressions#replace for usage details.'.

  • Expiscornovus Profile Picture
    33,505 Most Valuable Professional on at

    Hi @B8,

     

    Can you share what you are storing in the Compose 9 action or share a bit more details on how you configure the Compose 9 action?

     

    The error suggest it is not just text, but an array instead.

     

    The replace function does not work with an array in the way we used it earlier in that expression.

  • B8 Profile Picture
    258 on at

    I have 2 Share Point list data into it one link also which i am sending as customer Email and company name.

    EmailOFCompose 9.png
  • Expiscornovus Profile Picture
    33,505 Most Valuable Professional on at

    Hi @B8,

     

    Have you tried moving the Compose 27 action within the apply to each loop, directly after the Compose 9?

  • B8 Profile Picture
    258 on at

    Still it is not working after putting it in apply to each as you said loop

  • Expiscornovus Profile Picture
    33,505 Most Valuable Professional on at

    Hi @B8,

     

    When the compose 27 is placed within the loop can you try this expression in that action:

    replace(outputs('Compose_9'), '\n','')

     

    Can you also share a screenshot of where (in which area of the email body) that \n occurs? I have not seen it in any of your screenshots yet.

  • B8 Profile Picture
    258 on at

    Still it is not working 

    In compose 25 my email body is written. in compose 27 i had added the replace which you have given i put it in the apply to each loop. and in my send an email i am just calling the compose output output('Compose_25') i had use Output('Compose_27') also but still i am getting this \n in my email.

    B8_0-1671282008353.png

     

     

     

  • Expiscornovus Profile Picture
    33,505 Most Valuable Professional on at

    Hi @B8,

     

    Just a double check? You are using the br tag and html in your compose.

     

    Have you switched the send an email action to code view, before you added the compose outputs?

     

    switchtocodeview.gif

  • B8 Profile Picture
    258 on at

    My compose email body is  

    <html>

    <body>

    <br>

    <p>

    <a href="Link"></a>

    <br>

    </p>

    <body>

    </html>

     

    Your code still not work i added in view mode also

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 60 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 54

#3
Expiscornovus Profile Picture

Expiscornovus 47 Most Valuable Professional

Last 30 days Overall leaderboard