Format the email body

Completed

An email is often an official means of electronic communication; therefore, it's important to have the body well formatted.

Use rich text edit

Microsoft Office 365 Outlook and Mail connector have a Send an email action that allows you to format the email body.

Screenshot of the send email actions to format the email body.

The email action in both applications provides a comprehensive set of tools to help you format the text of your email body.

The code view (</>) option allows you to see the rich text format in an HTML format, which gives you the extra functionality to fine-tune the format.

Screenshot of the code view option to switch between rich text and HTML.

Add a signature by using the Environment variable

When you want to repeatedly add the same data as text, date, or numbers in an app, you can assign it to a variable and reuse that variable, which will make the process easier. Variables can hold a value at an app level and environment level. Three functions that help you create variables at the app level are: UpdateContext, Set, and Collection.

Environment variables are used to create variables at the environment level. An environment is a space to store, manage, and share your organization's business data, apps, and flows. It also serves as a container to separate apps that might have different roles, security requirements, or target audiences.

Microsoft Power Apps Studio comes with several variable functions, such as:

  • UpdateContext - Use the UpdateContext function to create a context variable, which temporarily holds a piece of information, such as the number of times that the user has selected a button or the result of a data operation. Context variables are scoped to a screen, which means that you can't build a formula that refers to a context variable on another screen.

  • Set - Use the Set function to set the value of a global variable, which temporarily holds a piece of information, such as the number of times that the user has selected a button or the result of a data operation. Global variables are available throughout your app on all screens.

  • Collection - The Collection function adds records to a data source called Collection. Collections are used to hold global variables that are available throughout your app on all screens.

  • Environment variables - Flows often require different configuration settings across environments. Environment variables as configurable input parameters allow you to manage data separately compared to hard-coding values within your customization or using other tools.

Environment variables are part of Power Automate solutions. Solutions are used to transport apps and components from one environment to another or to apply a set of customizations to existing apps. A solution can contain one or more flows and other components such as site apps, maps, tables, processes, web resources, choices, and more. For more information, see Solutions overview.

In the following example, we'll create an environment variable and use it in a flow to send an email. After the environment variable is created once, you can reuse it repeatedly in any flow in that environment. For example, you can get the company name and add it to all your emails.

Create a solution

  1. To create a solution, go to Power Automate, select Solutions, from the left vertical navigation, and then select + New solution.

  2. Add a Display Name and Name, select an existing Publisher or add a new one, and then select Create.

    Screenshot of the new solution details.

  3. Inside the new solution, select + New > More > Environment Variable.

    Screenshot of Environment variable within the new solution + New.

  4. Add a Display Name and a description.

  5. Select the Text data type.

  6. Type Contoso, Inc in Current Value and select Save.

    Screenshot of the New environment variable name and default values.

Create an Instant flow

  1. Inside of the solution, select New > Automation > Cloud Flow > Instant. Select the Manually trigger a flow option for the trigger and select Create.

  2. Select + New Step and search for Send an Email (V2)

  3. In the To field, enter your email address. Enter Company Event as the Subject.

  4. In the Body of the email, select the Add dynamic content and select the Company Name environment variable.

You have now added the company name as a footer in the email, and if the company name were to change, you can change it in the environment variable, which will automatically change across all flow actions.

Screenshot of the steps to add the company name as a footer in all emails.

Today we used a Text data type environment variable, but there are different data types for environment variables. For example, you can create environment variables to store SharePoint site and list addresses so when you move the solution to another environment, you can set a different SharePoint site and/or list for that environment. For more information, see Environment Variables overview.