I found it pretty simple to build a flow to send an email to my helpdesk email when a new conversation i started in a Teams Channel. However I'm having an issue getting the username to show up in the sent email. For this to work properly I need to know the user's email address that sent the mail. Does anyone know what code needs to be added to the flow to show user's email that posted the message?
Thanks in advance,
Ah, I see what you mean, just did a quick test myself. The user's email does not seem to be available in the dynamic content when you use the 'when a new channel message is added' action 😞
Okay, there's an easy workaround to get to the user's email address, @david-atx .
If you insert the 'Get user provile (V2)' action and feed that the 'Message from user id' dynamic content, you will then be able to use the 'Mail' output from that 'Get user' action. That will give you the user's email address.
I'm getting closer to the desired result! At least I can see who is sending the message now... Any ideas on how I can get it to show the person who posted the message as the from address?
Hi @david-atx ,
I had a feeling that that was going to be your next question.
If you use the 'Send an email notification' then that mail is always going to come from Microsoft Power Apps, as your screenshot shows. You're usually better off using the 'Send an email (V2)' action; that uses an O365 account. That action does allow you to insert a value in the 'From' field.
But... there's a very important caveat here: this uses the 'send as' method. This means that doing so requires the person that triggers the flow (ie. the one who posts the message in the Teams channel) to have 'send as' permissions on the mailbox of the account that the flow is running under. In practice you usually don't want to do that, especially if there are a lot of users who can potentially trigger the flow, as they would all have to have permissions on that mailbox.
So... long story short: there's no easy way to have a mail sent from the user that triggers your flow in this scenario as far as I know. It's a question that a lot of people ask.
An alternative could be to use the 'Send an email from a shared mailbox (V2)' action. That way mails still aren't sent from the account of the user who triggered the flow, but at least they aren't from your own account either. Instead they're sent from a shared mailbox.
Check out new user group experience and if you are a leader please create your group
On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks
Check out how to claim yours today!
Test your skills now with the Cloud Skill Challenge.