07 Implementing SendGrid Mail Service | Building Secure Web APIs using ASP. NET Core

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay hello everyone and welcome to another video from aka Academy in building is humor api's with SP told me a core identity and reason of tokens and this video we are going to implement a main service using centigrade service to use this to use it to send amines in the in implementing the email confirmation and reset password functions so let's get started first of all go to send grade calm and click start for free send a grid almost the best service to to you to send email address it's better than setting up your email and they use that SMTP service and something like this and centigrade from 12 is very relevant service and give you as much as you need from you means you can send up to more than 100,000 emails every day depends on your business signs and your needs so you can simply just create an account fill film the fields here and the create account I already created one so that's like blogging okay so here we go first of all the word step you should do is to go for sittings and go to API keys here click on create API key glasses give it a name call it off create a new view okay very nice here we go make sure to copy it immediately because you cannot show it again so I copied it very nice so this is number one now before we proceed to the next step let's go to OHP the whole project inside services I'm going to create a new class or an interface okay let's make it public and now put in a function task send email async don't you take string to string subject string content this is everything we need or in your sending an email the address room to send to the subject of the email and the body okay here I'm going to create an implement of this class column of the class centigrade okay now let's go to dependencies Mallory new packages okay here it is and grant install okay now let's go back to their website go clip a new profile here and go to setup guide okay here start on start integrate using our Web API choose the toughness and Web API okay c-sharp from here very nice so here is the full steps creativity you have already done that install the package we did okay now we save the whole code we need to implement the function so test it here very nice for the API key first I'm going to put it inside the app settings going to create a new variable called centigrade the guy key read API key and the key are you okay so we can handle it yeah in your calm yeah common configuration here private eye okay so now we can access with the app settings the recent file from the configuration here place this configuration SANDAG read API key client equals new Santa credit from email address okay you're going to make payment addresses test o their mother-tongue the user is the name is gonna see going to be later Big E oh okay nice a subject we are going to remove this time and to me this plain text content we don't need this and this here message helper takes from to subject plain text content and HTML the content so as you can see if this function create single email takes from email address to email address subject and the plain text that if you want to send just a text and here the HTML content I think all the times you are going to use a lot all the time you're going to use an HTML content show I use the same variable in two arguments okay here just like async okay very nice now let's add the service to our dependency injection container and start up don't see yes you click on services add ok very good hi name service standard main service I use transit because I just need one object each time I wanna each time with each request sorry and on want to use in a specific school or single tone just one object your application lifetime a transit can initialize an object just whenever we need or with each request now let's just test it okay I'm going to controllers side oath so here when we use private eye very nice okay I'm going to send me here in after the user login just for test if it's either go to send an email oh wait main service and I think to model you may subject you login the content here okay each time and okay good enough just right right now okay let's see what the users do we have another system okay so first I'm going to create in your account then I'm going okay so here register it's all it's saved from previous sessions from body I'm going to put my email here ah sorry I'm using the HTTP I disabled before so API URL disabled HTTP because it is a self-signed HTTP because it's a self signed certificate and inside the UWB we need an additional configuration to element that so I just decided okay click send ok our account has been created successfully now let's try to meet login attempt we can use the client here we understand app they won't stop your instance oh babe one two three let's login now she sends me an email to check out okay check John yeah aha okay it's here you see very nice my junk Inbox okay hey you log into your account once you log into your account okay that was everything for a decision we have implemented the centigrade maid service we're going to depend on it in our next two functions which is email confirmation and reset password are going to send the link inside an email address using send Bret hope you enjoyed this video if you enjoyed it please hit the like button and the subscribe to stay up to date with every new video thank you for watching
Info
Channel: AK Academy
Views: 17,986
Rating: undefined out of 5
Keywords: ASP.NET Core, Web APIs, Send Email, Send Grid, Email Confirmation, Security, Identity, JWT
Id: 4I1rYUbjAhw
Channel Id: undefined
Length: 14min 25sec (865 seconds)
Published: Wed Dec 18 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.