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

Community site session details

Session Id : L28tUKUjEoOyIyDWuPteQy
Power Apps - Building Power Apps
Answered

i want to send an email to the submitter(ie, current user) and also to send the email to the Current users manager.

Like (0) ShareShare
ReportReport
Posted on 19 Feb 2020 09:05:21 by

I have a submit screen with list of fields like User, Manager of the user and Title. Here the

*User is a current user so it automatically displays the User Name(Name_TextInput2.Text) by Hard coded -

Office365Users.MyProfile().DisplayName.

*And to get the Manager of the entered user by default(emp_Text22) by Hard coded-
If(!IsBlank(Name_TextInput2.Text), Office365Users.Manager(First(Office365Users.SearchUser({searchTerm: Name_TextInput2.Text})).Mail).DisplayName). This works fine.

 

Needed is: i need two different emails to send for two different screens.

1)Now if i click the submit its wants to send the email to both the user and the manager depends on the name in the Manager text box field(emp_Text22)  and with the html content of the submitted values.

2)For another screen i have a Data Table to store the submitted records. So all the users entries records are stored in DataTable1_1. if i select any one of the record in table then click submit ,the mail wants to send to the name of the employee as well as to the employee manager. I hardcore like this its shows error and didn't receive the mail too.

Clear Collect(Recipients,Office365Users.Manager(User().Email).Mail);
Office365Outlook.SendEmail(Concat(Recipients,Value&";"),"Emp Request","<table>"&DataTable1_1.Selected.'Name of employee'&",<tr><tr><tr>Your  Request for " &DataTable1_1.Selected.Destination& " on " &DataTable1_1.Selected.'Departure date'& " was " &AppRej_Radio_1.Selected.Value&" by " &User().FullName&" <td><tr><tr>comments: </td></tr></tr>"&Comments_TextInput1_1.Text&"</table>",{Cc:"",Importance:"High"});

 

please help. Thanks in advance

 

  • Verified answer
    mdevaney Profile Picture
    29,987 Moderator on 19 Feb 2020 at 14:46:35
    Re: i want to send an email to the submitter(ie, current user) and also to send the email to the Current users manager.

    @Anonymous 

    You did not follow my instructions or let me know the result.  Suggest you do exactly as I say.

  • Community Power Platform Member Profile Picture
    on 19 Feb 2020 at 14:44:09
    Re: i want to send an email to the submitter(ie, current user) and also to send the email to the Current users manager.

    In app for ,

    Name (textInput) i use: Office365Users.MyProfile().DisplayName

    Manager (TextInput)i use : Office365Users.Manager(First(Office365Users.SearchUser({searchTerm:Name_TextInput2.Text})).Mail).DisplayName)

     

     and in email part:

    // Send email to submitter
    Set(emailTo, Office365Users.MyProfile().DisplayName & "; " & Office365Users.Manager(First(Office365Users.SearchUser({searchTerm:Name_TextInput2.Text})).Mail).DisplayName & ";");
    Office365Outlook.SendEmailV2(emailTo,"Emp Request","<table>"&DataTable1_3.Selected.'Name of employee'&",<tr><tr><tr>Your Travel Request for " &DataTable1_3.Selected.Destination& " on " &DataTable1_3.Selected.'Departure date'& " was " &AppRej_Radio1_3.Selected.Value&" by " &User().FullName&" <td><tr><tr>comments: </td></tr></tr>"&Comments_TextInput1_3.Text&"</table>",{Importance:"High"})

     showing error status: 400

    message: one or more recipients are invalid

     

  • mdevaney Profile Picture
    29,987 Moderator on 19 Feb 2020 at 14:22:21
    Re: i want to send an email to the submitter(ie, current user) and also to send the email to the Current users manager.

    @Anonymous 

    As a test, put each of these in a new Text label inside your app.  What do they show?

    User().Email
    Office365Users.Manager(User().Email).Mail

     

    If the emails show correctly load them into a SET variable

    Set(emailTo, User().Email & "; " & Office365Users.Manager(User().Email).Mail & ";")
    

     

    Then use the SET variable in your code to SendEmailV2

     

    Office365Outlook.SendEmailV2(
        emailTo,
        "Emp Request",
        "<table>"&DataTable1_1.Selected.'Name of employee'&",<tr><tr><tr>Your Request for "
            &DataTable1_1.Selected.Destination& " on " &DataTable1_1.Selected.'Departure date'& " was "
            &AppRej_Radio_1.Selected.Value&" by " &User().FullName&" <td><tr><tr>comments: </td></tr>
            </tr>"&Comments_TextInput1_1.Text&"</table>",
        {Cc:"",Importance:"High"}
    );

     

    Make sure to use SendEmailV2.  Let me know the result.  

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Community Power Platform Member Profile Picture
    on 19 Feb 2020 at 13:34:53
    Re: i want to send an email to the submitter(ie, current user) and also to send the email to the Current users manager.

    #1 still the same problem persist. Didnt send mail..

    #2  Second one works fine. Now I got a mail. but what i need is once i click submit mail wants to send to user as well as the manager of the current user 

     

  • mdevaney Profile Picture
    29,987 Moderator on 19 Feb 2020 at 13:22:57
    Re: i want to send an email to the submitter(ie, current user) and also to send the email to the Current users manager.

    @Anonymous 

    You have simply copied and pasted the text from your original post here.

     

    Did you try my suggestions?  Please tell me what happened for each of #1 and #2?

  • Community Power Platform Member Profile Picture
    on 19 Feb 2020 at 13:00:13
    Re: i want to send an email to the submitter(ie, current user) and also to send the email to the Current users manager.

    Please take a time to look on it and do favor.

    I have a submit screen with list of fields like User, Manager of the user and Title. Here the

    *User is a current user so it automatically displays the User Name(Name_TextInput2.Text) by Hard coded -

    Office365Users.MyProfile().DisplayName.

    *And to get the Manager of the entered user by default(emp_Text22) by Hard coded-
    If(!IsBlank(Name_TextInput2.Text), Office365Users.Manager(First(Office365Users.SearchUser({searchTerm: Name_TextInput2.Text})).Mail).DisplayName). This works fine.

     

    Needed is: i need two different emails to send for two different screens.

    1)Now if i click the submit its wants to send the email to both the user and the manager depends on the name in the Manager text box field(emp_Text22)  and with the html content of the submitted values.

    2)For another screen i have a Data Table to store the submitted records. So all the users entries records are stored in DataTable1_1. if i select any one of the record in table then click submit ,the mail wants to send to the name of the employee as well as to the employee manager. How to add Manager as Cc in mail?. I hardcore like this its shows error and didn't receive the mail too.

     

    Clear Collect(Recipients,Office365Users.Manager(User().Email).Mail);
    Office365Outlook.SendEmail(Concat(Recipients,Value&";"),"Emp Request","<table>"&DataTable1_1.Selected.'Name of employee'&",<tr><tr><tr>Your  Request for " &DataTable1_1.Selected.Destination& " on " &DataTable1_1.Selected.'Departure date'& " was " &AppRej_Radio_1.Selected.Value&" by " &User().FullName&" <td><tr><tr>comments: </td></tr></tr>"&Comments_TextInput1_1.Text&"</table>",{Cc:"",Importance:"High"});

     

    please help. Thanks in advance

     

  • mdevaney Profile Picture
    29,987 Moderator on 19 Feb 2020 at 12:47:24
    Re: i want to send an email to the submitter(ie, current user) and also to send the email to the Current users manager.

    @Anonymous 

    Do I understand correctly that the problem is you are trying to send an email but nothing happens?  I think it would be best to narrow the list of possible issues.  Please try both of these tests.

     

    #1 Change the connector to SendEmailV2.  You should never use SendEmail since it is deprecated and could be deleted at any time by Microsoft.

     

    Office365Outlook.SendEmailV2(
        Concat(Recipients,Value&";"),
        "Emp Request",
        "<table>"&DataTable1_1.Selected.'Name of employee'&",<tr><tr><tr>Your Request for "
            &DataTable1_1.Selected.Destination& " on " &DataTable1_1.Selected.'Departure date'& " was "
            &AppRej_Radio_1.Selected.Value&" by " &User().FullName&" <td><tr><tr>comments: </td></tr>
            </tr>"&Comments_TextInput1_1.Text&"</table>",
        {Cc:"",Importance:"High"}
    );

     

    #2 Try inputting your own email address in the 1st argument and attempt to send the email.  If you receive an email there is any issue with your Concat statement or recipients collection.

     

    Office365Outlook.SendEmailV2(
        "yourname@yourcompany.com",
        "Emp Request",
        "<table>"&DataTable1_1.Selected.'Name of employee'&",<tr><tr><tr>Your Request for "
            &DataTable1_1.Selected.Destination& " on " &DataTable1_1.Selected.'Departure date'& " was "
            &AppRej_Radio_1.Selected.Value&" by " &User().FullName&" <td><tr><tr>comments: </td></tr>
            </tr>"&Comments_TextInput1_1.Text&"</table>",
        {Cc:"",Importance:"High"}
    );

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Community Power Platform Member Profile Picture
    on 19 Feb 2020 at 12:18:34
    Re: i want to send an email to the submitter(ie, current user) and also to send the email to the Current users manager.

    yeah, Ok. Please do the needful.

  • WarrenBelz Profile Picture
    148,894 Most Valuable Professional on 19 Feb 2020 at 12:15:08
    Re: i want to send an email to the submitter(ie, current user) and also to send the email to the Current users manager.

    Sorry - I just spotted what I thought was an obvious error.

    I am not an O365 directory user - I will tag one of my colleagues @mdevaney to see it he can assist.

  • Community Power Platform Member Profile Picture
    on 19 Feb 2020 at 12:01:42
    Re: i want to send an email to the submitter(ie, current user) and also to send the email to the Current users manager.

    i already have email coded like this to submitter but now i also want to send email with Cc to the current user's Manager(TextInput2).

     

    // Send email to submitter
    Office365Outlook.SendEmailV2(First(Office365Users.SearchUser({searchTerm:DataTable1.Selected.'Name of employee'})).Mail," Request","<table>"&DataTable1.Selected.'Name of employee '&",<tr><tr><tr>Your  Request for " &DataTable1.Selected.Destination& " on " &DataTable1.Selected.'Departure date'& " was " &AppRej_Radio1.Selected.Value&" by " &User().FullName&" <td><tr><tr>comments: </td></tr></tr>"&Comments_TextInput1.Text&"</table>",{Cc:"",Importance:"High"});

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2