Hi,
I used the Office365Outlook data source in PowerApps to send out an email notification based on fields and buttons clicked within a canvas app. I get an error from some individuals, and for some it pushes through correctly.
The code I used is something like this.
Office365Outlook.SendEmailV2("Email Address Here", "Subject Title Here", "Email Body Here")
For some resources, this sends out correctly using their account. However, for one resource, the email account sends using a shared mailbox.
I'm thinking it needs to specify which account, and so I tried using "From" inside the code. It looks like this. "varUser.Email" is a variable holding the current user's email.
Office365Outlook.SendEmailV2("Email Address Here", "Subject Title Here", "Email Body Here", {From: varUser.Email})
Again, this works for most users. However, for some, PowerApps returns an error message:
Office365Outlook.SEndEmailV2 failed: {"status":403, "message": "You are not authorized to send mail on behalf of the specified sending account" [...] code: "ErrorSendAsDenied"
Is there anything I'm missing? Or anything I should check out? Thank you. Any help is appreciated
that is why he was asking why you were using From in the first place because the outlook connector will default to the current users email so you shouldn't need to provide a From unless you wanted it to come from something like a shared mailbox. but he was also pointing out that you are creating another separate variable to hold the email when you could just use the following to provide the current users Email:
User().Email
{"status":403, "message": "You are not authorized to send mail on behalf of the specified sending account" - This just means that the app tried to send an email from an account the current user doesn't have permission to use. For the first scenario where the email is sending from a shared mailbox, if the user commonly uses the shared mailbox they may have the shared mailbox as their default sender in Outlook. I am not sure if PowerApps is able to overwrite this or not, but it would explain why the emails are being sent from a shared mailbox.
------------------------------------------------------------------------------------------------------------------------------
Please click "Accept as Solution" if this post answered your question so that it is helpful for people having similar questions. If you found this post helpful smack that Thumbs up button! Thanks!
Hi, I'm actually not specifying a shared mailbox. I used From in response to the first scenario, where on some resources, the email is sent out using a shared mailbox. I wanted to see if I forced the From property, if the app is going to use the logged-in connection instead.
First Scenario. without From : the result is that email sends out using a shared mailbox,
Second Scenario, with From : "error message 403"
My hunch is that it is bypassing the logged-in connection and using the user's associated mailbox for some reason.
hi @noelflores,
I agree with @WarrenBelz, it would make sense to use From if you wanted the notification to come from something like a department email rather than an employees work email. however, you will need to make sure people have the proper permissions to access that email group if using this method. otherwise the better route would be to let PowerApps default to the currently logged in user's email. it is automatically used by the Outlook connecter if no From is provided.
Hi @noelflores ,
I have to ask one question here - why are you bothering with From when you are using the user's email - the mail will always come from the logged-in user (their connection is used when they open the app). How are you specifying the Shared Mail Box?