cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gayathri_TU
Helper II
Helper II

Power automate send email from current user

Hi,

 

I have a use case that I want to email to be send from current user id who have created the item.

 

From address in the email should be the current user email.

 

can you please advice how to achieve the same.

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions

If you are using an automated trigger then the flow is running in the security context of the maker.  To use a different email address to send an email the maker account would need to have "Send as" or "Send on Behalf of" permission to that mailbox.  If there are only one or two from accounts that is possible.  But if there are a lot of possibilities it becomes very hard to manage and is impractical. There is no workaround.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Join me at 365 and Pwr EduCon in Chicago
EduCon Chicago 2022

View solution in original post

16 REPLIES 16
Pstork1
Dual Super User
Dual Super User

  • If the flow is running using a Power Apps trigger then you can include the current user email address as a parameter when the flow is invoked.  That address could then be used in the From field.
  • If the flow is running from a manual Power Automate trigger then the email of the user invoking the flow is included in the dynamic content from the trigger. That address could then be used in the From field.
  • If the flow is running from an automated or recurrence trigger then it is running in the security context of the original maker.  In this case there is no current user, just the maker account.  That email could be used in the From field.

Which of those triggers are you using?



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Join me at 365 and Pwr EduCon in Chicago
EduCon Chicago 2022

Hi @Pstork1 

 

Thanks for the response.

 

I am using automated trigger , in send email action if I configure Created by email in "Send As" section it throws the following error "You are not authorized to send mail on behalf of the specified sending account."

 

If you are using an automated trigger then the flow is running in the security context of the maker.  To use a different email address to send an email the maker account would need to have "Send as" or "Send on Behalf of" permission to that mailbox.  If there are only one or two from accounts that is possible.  But if there are a lot of possibilities it becomes very hard to manage and is impractical. There is no workaround.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Join me at 365 and Pwr EduCon in Chicago
EduCon Chicago 2022

Hi @Pstork1 

 

There will be lot of possibility in the email address so I will opt for PowerApps button trigger then. 

And one more query , how to pass multiple value selected in Combo box people picker field form PowerApps to TO address in Power Automate send email action through button trigger.

1) Here's the code for in Power Apps on the button.

ClearCollect(myemails,ComboBox1.SelectedItems);
SendEmail.Run(JSON(myemails,JSONFormat.Compact),User().Email);

Create a collection from the SelectedItems in the Combobox.  Then use JSON() to translate that collection into a JSON formatted array as a parameter.

2) Then in the flow.  Add a Parse Json action to parse the collection array you send as a parameter.  Since its an array you'll need an apply to each to get the emails into a semicolon delimited string variable.  Use that variable for the To:

image.png

Details

image.png

image.png



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Join me at 365 and Pwr EduCon in Chicago
EduCon Chicago 2022

@Pstork1 I have gotten the User().Email into the flow, so I can just use it as the sender? IT will be recognized as a connection?

Since the flow is triggered from Power Apps, you can use the email from the user triggering the flow in the SendAs field of the email.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Join me at 365 and Pwr EduCon in Chicago
EduCon Chicago 2022

Do you by any chance know if this is the same for if the flow is triggered instantly from a business process flow? I have a sense it should follow the same logic. @Pstork1 

No, flows that are triggered automatically will run in the context of the original maker.  To use a different address in the From field requires that the maker has Send As permission to that mailbox.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Join me at 365 and Pwr EduCon in Chicago
EduCon Chicago 2022

shavora
Super User
Super User

@Pstork1  I see, its considered an automatic flow even if the person has to click a button to execute it in the business process flow.

Apologies for the Swedish, its buttons that are the initiations of the flow: 

Skärmavbild 2022-02-25 kl. 10.57.14.png

 Which means we can get the ID of the person triggering it. But there might be an ambiguous line here of what is an automated and an instant.

Skärmavbild 2022-02-25 kl. 11.00.10.png

 

In this case the trigger is an automated trigger because its being triggered from Dataverse.  When you click a button in Power Apps that is considered a manual trigger.  The one I think you want is the following.  Is a manual trigger and should run in the context of the person running the business process.

image.png



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Join me at 365 and Pwr EduCon in Chicago
EduCon Chicago 2022

I have this question too, I wonder if you can help with this scenario?

 

I have a cloud flow which passes data from a form to an approval process if approved, an email is sent to one supplier (and asana tasks are also created in other conditions).

 

I'd like to send from the person who created the form (this can only be done by users within our Microsoft 365 Environment). At the moment I can only send from me as I created the flow, but this clearly isn't ideal for lots of users.

 

New IT User Power Automate Flow.png

 

Can you suggest how I could adjust this?

Since this is using an automated trigger for when a form is submitted you can't send an email as the person who created or filled out the form unless you have "Send as" permission to their mailbox.  



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Join me at 365 and Pwr EduCon in Chicago
EduCon Chicago 2022

@lwt-hot you can create a user that does all emailing and name it something neutral and appropriate and then use that mail as sender. In the email you can write on behalf of [user that triggered the flow] and if they need to respond they should do so to their address. You can send a hidden copy to the user. 

 

It might not be ideal though... And using getting permission on mailbox is better. I am myself debating about these options. 

Just to clarify what @shavora said.  Using a neutral account (a service account) will work, but you then need to create the flow using that account as the maker or obtain "Send As" permission to that one mailbox so you can use it in the From.  



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Join me at 365 and Pwr EduCon in Chicago
EduCon Chicago 2022

shavora
Super User
Super User

Yeah, share as owner to a service account has worked for me. And then I added the reference connection for that service account on the email action.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Users online (2,183)