Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sending Emails using Office365.SendEmail()

I want to send the email when a SharePoint list item is added and have several questions on how to process.

  1. I found that I can connect to Office 365 Outlook and use Office365.SendEmail() function which is pretty simple. The only question here is what is better in terms of which practice seems to be accepted or works the best. Compared to Sending Emails with using Microsoft Flow on PowerApp event, Microsoft Flow on SharePoint list event or sending within PowerApp using Office365.SendEmail(). Is there benefits of using one option over another?
  2. I have trouble getting email from a field. The field is People/Group in SharePoint. I have this function in the OnSuccess trigger of the form:
    Office365.SendEmail(DataCardValue17.Selected.Email,"TEST","TEST");Navigate(MainPage,ScreenTransition.Fade); ResetForm(FormCreateTravelRequest)

    When I run the app and the form I get the following error on the Office365.SendEmail() function:
    The service returned an error: Office365!SendEmail: The method ‘SendEmail’ has an invalid value for parameter ‘To’
    Here is the pic:
    Now I thought maybe it is not pulling the email correctly from the form field, to test that out I created the Label1 and its text changed to:

    It appears to show the correct email. To test if it would work I changed the OnSuccess function to:
    Office365.SendEmail(Label1.Text,"TEST","TEST");Navigate(MainPage,ScreenTransition.Fade); ResetForm(FormCreateTravelRequest)

    I tried to run it again and now I get this error:



    The service returned an error: Office365!SendEmail: {“status”:404,”Message”:”User account does not exist”,”source”:””}
    Here is a pic:



    I thought maybe its because it has suffix, even though I tried to send myself an email with the and it worked same as just using my real email address. To remove that I changed the text function of the label to:



    However, this still produces same error (User account does not exist)

    So now I am at a loss, what I am doing not right when trying to send the email?

  3. I want to send a complex HTML email. How would I have to change the Office365.SendEmail() to do that?

    Is writing this function enough?


    Office365.SendEmail(Label1.Text,"<b>HTML TEXT</b><br><em>Hello World</em>","TEST",”isHtml:true”);


    Does it matter that I put all HTML in the Office.SendEmail() function, would it be better if I added an HTML text control and made it hidden and then just linked it to the function?

Any help really appreciated!


Accepted Solutions
Frequent Visitor

Hey there you can use concat function to solve it. Save your mail in a Collection and Office365.SendEmail(Concat(Mail;Email;";");"TEST";"TEST").


It works ^^

View solution in original post

Community Support
Community Support

Hi @Anonymous,


This sounds like the Office 365 Outlook service error. Please take a try to switch to a testing account (different email format, take a try with the free trial) and check to see if that would work.


I just tested the following code:


It works from my side, I received the corresponding Email.

the format of the testing Email account is the following:


Besides, to send the Email in HTML format, please try the following format:

          DataCardValue12.Selected.Email, // To field
           "Text",                        //  Subject Field
           "<b><font color=blue>HTML</font></b>text"           // Body Field, this could also be HtmlText1.HtmlText     
           {IsHtml:true}                  // the record elements for other parameter          


Function reference:


Office 365 Outlook




Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Not applicable

@v-micsh-msft Thanks for the reply really appreciate that! Do you know what could be the problem with the Office 365 Outlook service or how to fix that? Also, are there other options to send email? 

Not applicable

I went ahead to do some testing and tried to create the email sending with the Flow.


I set up my Flow to activate when the new item is added to SharePoint site. Whenever I try to run the flow I still get the same User account does not exist. I asked around my colleagues about our email system. We are using Sherweb service, would that be the issue as we are not using Exchange? If so, are there any work arounds?


Also I tried to set up email with using simple Mail datasource from PowerApps. I tested it our by writing


However I get the following error:



The service returned an error: Mail!SendEmail: The method 'SendEmail' has an invalid value for parameter 'to'

But the email in Label1.Text is correct.

When I did this:




I did recieve the email. But that does not allow me to dynamically change the email or the body of the email.


It happened to me as well. It's an issues with the Studio Only. When you are in edit mode, if you navigate to that screen without actually selecting the dropdown, it doesn't "see" the value, even though the same value in a label works. So you can either make a label take the value and then import the value from the label in the Office365.SendEmail syntanx OR just try the app and it will work.


I have noticed that there are some diferences between using the Studio and the Live app. In studio sometimes the values are not imported properly while using the app live, works as it should.


See if using the app by Opening it, will still cause the error , if yes, try the solution with the label and using Label.Text to import that value into the email.


I still strugle with another part: If I have two labels and one is blank, how can I use the TO field without using If's ... since if one is blank, the entire syntax fails as it cannot process blank values when sending the data to Office 365 Exchange for the TO Field. 


Good luck!

Advocate II
Advocate II

I found that using a flow button works.

Hi @v-micsh-msft


will it work if i use a sharepoint people picker with multiple selections? or if it has a sharepoint group name choosen



Helper IV
Helper IV

Did anyone get any resolve to this issue without using MS Flow?

I am the creator of an app and the Office365.SendEmail seems to work for me, but when I expand testing to other individuals in my organization they receive the error:

         "Office365.SendEmail failed: The method 'SendEmail' has an invalid value for parameter 'To' "


I've verified all connections are made in the powerapps, and access has been granted to the SP list.


Any thoughts @v-micsh-msft


sendemail error.JPG

Did you ever find the solution to this?

I used MS Flow to handle all emails. In general, MS Flows greatest asset is to perform an action based off a trigger. That trigger being selecting a button in a powerapp, then let Flow handle the action. I find that using that structure cleared the errors.

Helpful resources

PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group


Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,957)