In power apps we mostly send emails using the office 365 connector, today I would like to show you a different method to send emails in power apps using the MAILTO Uri scheme. This works the same as the default office 365 connector.
Using this method, we can save the load time of the application when sending email as in this method email is sent using the URI scheme which will transfer data to the default mailbox being used on the device.
I will illustrate an example below in which we will send a sample email using the URI scheme, wherein we will read the sender information and email body from the app inputs.
Step 1: Open power apps home page and click on the "CREATE" option to create an app from blank.
Step 2: After entering the app name, and clicking on the button you will be navigated to power apps studio. Herein we will add input parameters to the application and customize the functionality.
On the studio page, click on "INSERT" and select "TEXT", you will be displayed with a set of options to choose from select TEXT INPUT. This will add a text input control to the application.
Repeat the process three times, we will use one for entering the TO address, one for email SUBJECT and another one for email BODY. You can also make use of the rich text editor for entering the email body.
Step 3: Now we will add a button to the power app, wherein we will configure the URI scheme. Once you add the button to the power app screen move to the onselect property for specifying the formula.
Launch("mailto:"&'email address'.Text&"?subject="&subject.Text&"&body="&body.Text)
I have renamed the text input controls that I have added to the email address, subject, and body, and my formula looks as above. You can just rename them by replacing the names with the names of your text input control.
Step 4: When I click on the button it will transfer the information that I have provided in my text input controls to the default mailbox enabling me to review the information before sending the email.
Breaking down the mailto scheme
Herein, we will see how each element is adding value and how to specify additional options in the formula.
mailto: This will initiate the scheme indicating to launch the default mailbox enabled on the device.
subject: The information specified here will go into the subject of the email
body: The information mentioned here will go into the body of the email.
once we specify the mailto then we will separate the additional elements using ? after that all the elements will be specified using & symbol.
A simple formula for sending an email with basic element inclusion is as follows
mailto:emailaddress?subject=test&body=test
If we have to include additional elements such as cc or bcc then the formula will be as follows
mailto:emailaddress?cc=emailaddress&bcc=emailaddress
&subject=test
&body=test
For more reference related to mailto URI scheme please check the link
#powerapps,#mailto,#email
Comments