I have a simple PowerApp based on a SharePoint Issue Tracker list. When a new item is added I want to send an Email to a group of people notifying the action. However, instead of coming from the user who created the new item, I want the email to look like it's coming from an Email distribution within the company.
First up, I created a flow in Power Automate, where an email is sent when a button is pressed in PowerApps. Pretty standard stuff, with only addition being "From (Send as)" set to the email distribution I want the email to look like its coming from. I have made sure that my account has "Send As" permissions to this distribution.
Next, from PowerApps, to the submit button, I added the following code:
SubmitForm(EditForm1);
EMail_Notification.Run(
varSendTo,
"New Item Added: " & EditForm1.LastSubmit.Title,
"EMAIL BODY HERE"
);
This works fine when I use my account to create an item, and I get the email as expected. However, when I try with a different user account, the flow fails with the following error message.
You are not authorized to send mail on behalf of the specified sending account.
It appears that even though I have the ownership of the flow, the user who clicks the button must also have "Send As" permission to the email distribution in order for this to work. I want all people in my organization to be able to use my app, but obviously I don't want to give everyone the "Send As" permissions to the email distribution.
Is there a way for a PowerApp to send email notifications appearing as coming from a certain email address?
Used a automate flow with a trigger on modified item
(on created could work but using created sometime bug or does not trigger and then you cant manualy trigger it).
So to avoid that, i'm using a "List item Modified" trigger with conditional parameter to check a boolean column so it will not trigger for every action on that list item.
Having a column "MailSent" set to true by the flow once the job is done and set to false form app when you want to send.
As the flow is not triggered by a user, it will use the flow connector's credential.
How to send mail with Power Automate:
Create flows for popular email scenarios in Power Automate - Power Automate | Microsoft Learn
How to add parameter to a trigger:
Power Automate Trigger Conditions made EASY - Power Platform Community (microsoft.com)
For everyone who wants to send an email from a flow creator connection, edit Run only users in your flow will work.
You should not use PowerApps as the trigger to send out the emails as it will require the specific user that presses the button to have rights on the email. Instead, use the SharePoint list as your trigger. In other words, whenever an item is added to the SharePoint list, start a PowerAutomate.
Thanks for the reply, but that doesn't quite solve my problem. My account can send on behalf of that email without any issues. My need is for an email to be generated and sent whenever anyone within the organization creates a new item from the PowerApp, and I want the email to look like it's coming form the aforementioned email distribution.
I can't give everyone in the organization access to a shared mailbox so I'm looking for an alternative.
Hi! If you are sending an email in behalf of someone else, you can only do so if that person has given you permission or assigned you as a delegate to his/her mailbox. I would suggest you use a shared mailbox with you as an authorized sender, that way you can use the "Send an email from a shared mailbox (V2)" action. Hope this helps.
-bochie
WarrenBelz
146,658
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional