PowerApps Send email - Everything you need to know about sending mail via Outlook and Power Apps

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in today's show we're going to talk about powerapps send an email and so sending an email is something we've all been doing for a really long time but everyone kind of has a little question well look oh cranny they don't know so what i thought i would do is make one video that showed you kind of in the end all the different things you can do to send an email from powerapps but first here's our intro hi my name is shane young with powerapps911 those guys and today we're talking about powerapps send an email and what we're going to do is we're going to explore the outlook connector so the outlet connector lets your users send an email by pressing a button in their power app don't need any extra tools anything else involved they press the button it goes but a lot of times i find when people might send that first email they have further questions around well what if i want better formatted emails what if i want to bcc or see somebody cc somebody or do attachments or this or that so what i thought i would do is just walk you through kind of end to end all the different pieces that are available so you can kind of finally say all right cool i understand it and when people ask me questions about email and be like oh this is the video and as you might know i made this same video about two years ago i mean so if you look over there i have just shy of a hundred thousand views like literally i should have waited another day and made this it would have been a hundred thousand but anyway so what we're going to kind of do is you know the the connector name has changed a lot has changed so we're just going to re-explore the topic so blah blah blah blah blah blah let's switch over to my desktop and take a look so over here on my desktop you can see we're going to go through we're going to send a simple email explain how that works i'm going to talk about cc and bb bcc easy for me to say and then we're going to uh change the importance level because they come out as low by default which is annoying we're going to talk about sending emails from another user so uh changing the from and kind of security around that then we'll use this cute little form it's just some different inputs we're going to talk about how to get you know look up against office 365 to get the list to your users so i can pick you know two or three people maybe i want like hey i want shane and i want chewie in here and so then now you know i've got a couple people selected and how do i send an email to multiple people when i look up the data via a combo box here or any other mechanism you can do to get the data so we'll use concat for that some simple inputs we'll talk about how the body of the email is actually html so if you want to make beautiful emails unlike my ugly app here then you can definitely do that we'll talk about how that works we'll look at attaching files and sending those off so very fun then we'll also just make sure you understand some of the advanced concepts we won't get into the details of deep linking but at least once you understand how you can send an app or send a link back to your apps it will open a specific page a specific record inside your app so make sure you understand what that concept is so you can go do more research if you need to do that or then finally we'll also send a dynamic table and signature with an image right and we'll just press this button so we see how cool this looks this will be our kind of our grand finale and so there you go that'll be our final email we send there we'll also talk a little bit about security along the way and just things i want you guys to know about email so hopefully i can get through this pretty quick but i want to make sure you guys have a thorough understanding so it'll probably be longer than i wanted my bad all right so let's talk about how this app works so the first thing you need to do actually let's go over here is make a new screen is if we throw a button on the screen if we want to send a email what we need is we're going to need to add the outlook data source and so you can see over here i've already got those data sources but we're going to remove those just so there's no confusion and then this is just some data we'll use later ignore that one but so if you have no nothing over here what you're going to do is just start typing in outlook and so one of the things that's really confusing you know is basically the name of this connector is changed about five times so as of you know august 2020 this is the name of the connector but i just want to make sure you guys kind of had an appreciation for it changes a lot and so if you see old documentation it's probably still valid anyway so i'm going to choose i want the microsoft 365 outlet connector and if you don't already have a connection here you can just say add a connection and it will literally connect now one of the things you need to understand about this is in order for this to work you have to have an exchange online email box so if you're not still in a hybrid scenario where your exchange is still on prem even though you're using office 365 this connector will not work for you you have to be in exchange online and all the users that you want to press the button have to be there so that occasionally gets people so i want to kind of throw that at you guys but now that that's been added what we can do is we'll go up here to our button we'll say hey i want to and to start typing in microsoft there you go and so it is microsoft 365 outlook is the root of the connector and if we just press down a whole bunch here what the primary one i want you guys to use is this right here microsoft 365 outlook.send email v2 now if you see v3 pop up at some point then i'm going to switch to that right away right whatever the latest v is in some of these you'll see like a v4 and v5 but for the email it has been v2 for a while and i just want you to make sure you're picking v2 because it has the most functionality and those other ones are slowly being deprecated so i don't want you guys writing against old stuff so for the two the two has to be a text string that is a valid email so in this case i'm going to say shane powerapps911.com and then we're going to do a comma and remember in powerapps my strings had quotes around it and we'll talk about how to add additional emails in a second so the subject is the same thing it's just a a text so let me say subject goes here like so and then finally the body is also just text body text so then now we've got everything that is required so i can just close my parentheses and i can press the button so i'm hold down the alt key and press the button to do a test now there's a few things you need to understand whoever presses the button is who this email is going to come from so it's not coming from you the app maker is coming from the person who pressed the button there's a couple ways to see that so let's first look at the email so you can see subject goes here body text it was sent to me it was sent with low importance we got an email yay and if i was to look over in my sent items which i don't think there's an easy way for me to show you guys my synth items but over here my sent items i see this same email i can open it up and like boom there it is so that's also important if you're like well what happens if they send a broken email right so if i change this to bob at powerapps911 there is not a bob here and if you press send powerapps isn't mad powerapps doesn't know nothing happened because all powerapps did we said hey outlook send this email to this person for shane blah blah blah so if i go and look in my sent items i see the email and then in my not so sent items i then can see that i got a undeliverable report back and says hey basically the email bounce right bob isn't a person sorry so your users are going to see that in their email box not in the app another point of confusion okay but there you go so if you understand that you can send a basic email if you want to send this to two people so if we said hey i want to send this to shane and i want to send it to chewie we can just do this and be like oh and then chewie at powerapps911.com and so then now if we press the button it will go to both me and to chewie right well this just will put us both on the two line not a big deal um so then from there what i would probably say is you know well you know subject goes here so remember that like with the subject it has to be a string but you can make the string whatever you want it to be so you could incorporate variables you can incorporate data lookups to other sources whatever you want as long as it is valid text between these two commas right here it's going to go as the subject for the body we're going to take that one step further so everything from here to here has to be valid text but when you send these emails they are html emails so what that means is that the body of the email can be html so i can be like hey body text and then we'll do with and then we'll say we'll do a b like this and say bold and then if we press and send this button that word the word bold will be in bold because that is the html syntax for sending it bold so if you have html skills this is what we're going to spend a little bit in the end talking about is massaging this html to make these beautiful outcomes so if i look over here let me open that email real quick there it is so then you can see body text with bold and keep in mind sometimes because these emails are sent with low importance it might take more than like i like them instant and sometimes it might take that case it took like 45 seconds to show up for whatever reason so don't get frustrated too quickly if it takes a while but that's the basics of sending these emails right we need a text email or we need email we need a subject and a body now when you put the formula up here you notice with the send email v2 to subject body comma dot dot dot so that means there's some optional parameters i like optional parameters so i'm gonna throw a comma right here it's gonna tell me that hey then you can have from you can have ccc cc whatever that is you have bcc you can have attachments you can do importance so let's say we want to do a bcc you just do that and then it was just text again right emails are always text and so we can just say bcc shane at powerapps911 and then shane would be bcc'd you close the curly brackets all the optional parameters go inside curly brackets but they're not separate right so if i also want to have a cc then i would just do this oh there's cc also notice that c cc has that's real harsh to me to say a large c and a small c and b c c is a big c a big b and two little c's it's just how it is deal with it but anyway so then for cc you know i could just do this again we could be like a cc chewy and so then just like that now we've got an email that would go out with bcc and cc also maybe i want to set the importance let's press down a few times so the importance you can see right here it's auto suggesting you want high low or normal they go low by normal by they go by low automatically so if you want to change that to either normal or you want to annoy people those high urgency ones oh i hate high i hate importance emails but you get them anyway you can do that and so that's what that syntax would look like now another piece of this though might be from now you say hey i want to send this email from chewie powerapps911.com so i have these send on behalf permission to chuwi so whoever presses the button has to have the permissions to send as that person if you want them to send that email so not only would that let me send it via this power app but it also would let me send it by outlook or anything else and what is that exact permission let me switch over and show you real quick so i went to the office portal and then we go to admin right here and then i'm going to click on users and then active users and then i'm going to find chewy i'll click on chewy and so then in chewy's record you can see there's mail and then there is send as permissions and so this is where i added myself so given my idea will do is because i had the rights now also it is possible i will not get into it if you can go bing it if you want to find out but it is possible chewie could have granted these permissions for me but i just took them from chewie because i mean to my dog right who's asleep right there lazy dog anyway so if you want to use from here then you're going to have to have those permissions all right um so and then last but not least is attachments we're going to switch to the other screen i think to show you guys a little bit about attachments okay so this is the core so now you understand the core let's go look at how i did some of these buttons over here so go back to my sending email screen you can see i made it real angry and so it's what it's mad about is because i took away the user's connector and so the user's connector is what i was using to find my office 365 users to pull in my photo in this case so let's just add that one again so i go over here and i'll just be like hey i want users there's the microsoft 365 users connector and so i'm just going to choose one of my existing ones or i could add a connection the same way we added the outlook but now that that's here my app is happy good job app and so then now let's just look through these buttons real quick so send a simple email we did all that it can be html cool email with a bcc and a cc they're cool and keep in mind that uh this app as we're kind of walking through it you know if you're a subscriber at training.powerapps911.com to the curated library you can download this video you can download this app and so you don't have to go rebuild all of this stuff you just go grab it all so that's why i have these fun little demo apps it's for all the subscribers so here we've got send an email with high importance and so that's the same thing pretty straightforward there's the syntax for sending from chewing straight forward again so then now let's go over here and talk a little bit about the attachments and sending based on an input so let's just look at this button and talk about what it does so it's our normal send email v2 now up here in the 2 right it's everything in front of the first comma i am using a function called concat and so i've got a separate video on that i'll link to it i don't know somewhere on here but the concat function takes a table of data and turns it into strings so this combo box up here if you look right this is a combo box it switched right here so we make that more obvious there we go so combo box one so combo box one it has a selected items property and so that selected items property is returning all of the selected users and one of the things i will often do is just throw a label on the screen let's start like right here and so in this label we're just going to say hey i want you to concat combo box one combo box one that selected item so that isn't going to return a table of data all the selected items and then just give me their mail address so mail that is the field and then i want to separate that by a semicolon so then that if you look right here you can see that is why we see is put it up here that is why we see shane and chewie and so if we were to hit play and then like if we choose uh nikola so search for nicola and so if we do nicola you can then see it adds her so and remember this is the syntax that we were looking for for sending a valid to email so that concat function is how we're turning that table of email addresses into just the email addresses so we can use them and the items property here is using the microsoft 365 users connector we just added it's using the search user function and it's returning the top 999 people which is the most it can return if you've got more than a thousand people in your org then you're going to have to use a special technique to kind of search these users you can't just list them all like i did here and so i've got a separate video somewhere again up around here for that if you need to pull in more than a thousand we won't go through that today okay so that gets you all your users the subject field here's just a regular text input and then here for the body you can say hey you know why did that why did you use a rich text editor so the reason for that is the rich text editor allows people to format text right so i can take this word this and be hey i want you to be highlighted in this weird yellow color and so then now that text is highlighted but what's happening and this is where i love my labels as if i just do rich text editor one dot html text they're actually in the going through and writing all the html to make the text look that way so i don't have to figure out how to write that html it's right there because what do we know we know that the body of an email can be html this control lets you do html boom marriage made in heaven we don't have to worry about that too much okay so then last but not least here we've got attachments and so what i did was i stole the attachments control from a sharepoint list so if you go to a sharepoint list if you add a sharepoint list to your app as a data source right let's just do that real quick so we'll go here we'll search for sharepoint i'll choose my sharepoint site we'll go to powerapps videos and then basically all your custom lists they have a um an attachments column so if we connect that so that's in the app now and we'll just go back over to that new screen again so right here type in my other screen and so if we insert a form control so edit if you tell the form that it's items and we'll just expand this left side is the sharepoint list right here it then goes ahead and grabs all the fields and one of the fields is an attachment field so i actually just grabbed this attachment control right you can just copy that so ctrl c come over here and you can paste it outside of there and when you do it you have to kind of fix it up you have to make it hap happier again but once you've done that you've got an attachment control right you just flip these errors like oh what are you mad about oh the border color i can care less so i'll just make you black and you're still mad so hit the drop down edit the formula bar your items well you don't need any items there you go and then last but not least your tool tip yeah you don't need a tooltip either there you go oh one more looks like what else you made about display mode you're just display mode dot edit there you go so now we have a happy attachments control which i can then copy and i just put over here on this screen because the nice thing about the attachment controller like hey i want to you know attach a file so i'm like hey i want to attach this picture of uh chewy sitting on the porch there you go i like this one chewy relaxing and so then now that that's there we can send that in our email and so looking at our email what we're going to see is that right so we got our concat of our upper items subject was just subject it's pretty straightforward rich text editor was our body and so then now we said all right attachments that's how we reference attachments and so what attachments needs is it needs a table with a column called content bytes that is um has all the pieces that you want to email right all the the body of the thing so what i'm doing here is i'm saying hey take the attachment controls output so attachment control dot attachments that's the table of attachment results and rename the value column that came from that into content bytes so content bytes and then that's the blob and then the file name is just the name still so that's all you have to do right remember close the little curly brackets here but that right there that little chunk of code will then let people attach files and send them over now people often will say what if i want to attach something with a camera control or attach files i get from downloading it from sharepoint whatever right what all that matters is that when you pass to this attachments option it has to be a table that has a column called content bytes where you put the blob and a column called name where is the file name so and i have a separate video that walks through the attachments control i don't know once again it's up there somewhere but that whole video is like 20 minutes of just explaining all that and super nerdy details so i just want you guys to get the idea you can do these attachments right because if we take this now and we say all right this all looks great if we say send this email it should send me an email or i should send oh i'm getting in trouble because i sent nicole wait anymore it's gonna send me nicola and chewie all an email with a subject to test this body and this file attached and there it is let's open it up there you go you can see all three of us on the two line there's the file there's this format stuff nice whew okay we're almost we're getting there right this is the toe just to be longer than i expected so then now the next one here i want to do is i want to show you this thing here it's called send a deep link someone press the button so you can kind of see the email that it gets and then we'll explain how the email works so deep links is how we send a link into a power app or into anything right but in this case into another powerapp and it has a in the url it's going to reference a id so we can kind of connect the dots so let's open this email so here's just the link because shane is lazy quite chewy and so if we hover over that you can kind of see it's got a whole bunch of stuff there so let's just click on it see what happens it is going to open a power app and not it doesn't take me the home screen of that power app if you look up here in the url i am actually referencing the employee id of four which chewy's employee id happens to be four and so that's how it knows what record to show me and it's showing chewy's record right if we change this to one i think that is nicola's record so it should open it up and it takes me straight into nicola's record so that is what we call deep linking once again i have like a half hour video on that one as well oh so many videos i know but i'm trying to expose you a lot of concepts here but so that that would walk you through how to build this because it is a little complicated to set up deep linking but once you do now instead of sending somebody in an email saying hey go look at this item or look at the document making them go to the app and then find the the thing by navigating you can send them a link straight into where they want because this if we look this is actually the home screen of that app right but we didn't have to come here we just jumped straight to it there's daniel again um we just jumped straight to it because we had a deep link into in our case record four which was chewie's kind of cool huh all right that's deep linking so then last but not least is you know if you guys want to get a little more complicated and that's when you say hey i want to send a uh email so in this case you know we sent a dynamic table this is not nearly as hard as it you think it is so if we kind of get the stuff out of our way so what happens here is outlook's an email to me subject that is hard coded and so for the body i said hey just send whatever is in the html text and this is what we do in a lot of our customer apps because it's easier for us to write html in the html control and so we'll just put this in their app and we'll make it invisible so no one can see it but it's sitting there so in our email lines we don't have all the html we just have a hard-coded link to this because this control then has all the html and then html talks about you know the table so it's got style for tables and tds and th's and then down here what we're doing is we're using the concat function and this is how we are going and looking up against our employees data source and pulling in all these dynamic rows we're making a row for every line in our sharepoint in our table automatically and then at the end because somebody told me that they didn't want to see a picture of me i had a way to add a dynamic signature so that whoever the user is that clicks on this button the email will have at the bottom their user.name and then you can also include their image or what we have here is the image source that is the um the company logo so that way we kind of have that company branding because maybe you're using this to send emails to your customers or things like that we do a lot of that type of stuff if you scroll way down here you'll see you know this is the base64 the encoded version of the image and then um so here's the height and the width and then i'm using when you're trying to use alt in my uh things as well right so if someone's using a screen reader or something like that they would understand that this was an image of a cartoon version of the chewy the dog who's a golden doodle very kind i know but you know if we press this button you know it's sending over all of that stuff now one of the things that you'll need to get used to though is if you look at this html you can see like it doesn't look very good here and the image is broken and you're like oh that looks bad okay one of the challenges of the power platform ecosystem is there's like 17 different html rendering engines and so this engine does not know how to do the uh the table formatting the way it does and it can't handle an image that is encoded that way i don't know why it just can't but if we go over here and press this button again because i still haven't got an email but if we go over and look at the email you'll see that the email has lines it has gray shadow for the headers and it has the image so one of the things you'll have to kind of get used to is just because as you're writing the html it doesn't look right over here right it doesn't it's going to take a little bit of massaging to understand what the output is going to be and one of the things that drives me crazy is trying to make the little profile image be circles you know what outlook doesn't support html images being a circle in in uh outlook i don't know why it just doesn't so a little nuances like that drive you crazy okay so that's a whole bunch of information i know this email there's a lot going on here but i wanted to kind of hit everything now other things that you might be thinking about is you know what about if you want to send um you know emails could you use flow yes some people will actually just take the output of what they want here send it to flow and then let flow send an email go because it's easier to format and stuff or easier to do attachments cool no problem with that i just don't like to add flows into the mix if i don't have to but you can definitely use flow to send your emails from powerapps if you prefer to do that another one was someone asked me you know what about if i want to go look up data well so this is showing you how to look up data for the body of the email but then there's also what if you wanted to look up like who you want to send this to or things like that you totally can because remember all that i care about in the end for this you know two portion or not i care about powerapps cares about is that you give it text representation of an email address it's not going to validate it's a valid email address but as long as you give it text it's going to try and send email to that text so if you could get this this could be stored in a variable this could be a lookup this could be concatenated like we did over here i don't care how you get to these things you just have to know what it expects and when what format expects it and pass it over so all right hopefully that helps i will put links down in the description below of all the crazy videos that i just referenced because there's a lot more to learn here but now i feel like if you watch this and you comprehended this video then you've got the whole story you know all the things that can be done now you might be saying well what about if i want to send emails by a gmail or one of these other third-party providers there are connectors for a lot of that stuff but i've never had like a real business case to use them so i've never made any content on any of those but in the end of the day that is all possible as well if you have any questions comments leave them down below i am i answer all my comments um i respond to all my comments i should say sometimes it might take me a few days or a week to do but i get there and then of course if we can help at all you feel free to reach out um you know we've got the training over at training.powerapps911.com or if you want to work together i can do uh if you go to powerapps911.com we've got some services over there and with that i'm gonna say thanks and have a great day before you go be sure to click on the subscribe button over here so that way you'll be notified when new videos come out if you need any help or you want to work together whether your problem is big or small check us out at powerapps911 we do it all i rhymed or if you're looking for more formal training offerings we have those linked up here somewhere so check them out thanks and have a great day
Info
Channel: Shane Young
Views: 142,170
Rating: undefined out of 5
Keywords: Shane Young, powerapps911, PowerApps Send email, powerapps send email to multiple recipients, powerapps send email with attachments, powerapps send html email, powerapps send email function, power apps send email, microsoft365outlook.sendemailv2, office365outlook.sendemailv2 powerapps, powerapps email attachment, powerapps email collection, powerapps email body, powerapps email form, powerapps email function, power apps, powerapps, send email, outlook send email powerapps
Id: vpYkOccwn4Y
Channel Id: undefined
Length: 28min 26sec (1706 seconds)
Published: Mon Aug 03 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.