From the course: ASP.NET Core: Communication Management

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Send an email to a single receipt using SendGrid

Send an email to a single receipt using SendGrid - ASP.NET Core Tutorial

From the course: ASP.NET Core: Communication Management

Start my 1-month free trial

Send an email to a single receipt using SendGrid

- [Instructor] Now that you have set up both the SendGrid account and the development environment, let's send the first email. For that let's go to Visual Studio and see it in action. In here go to Solution Explorer, then Data, Services, EmailService. And you scroll down to the SendSingleEmail method where we are going to write all the necessary code. The only thing that we have in here is the API key. So using the API key, we are going to create the SendGrid client and define all the necessary data. So let us first create the client. So var client is equal to new SendGridClient and let us specify parameter the API key. Then next, we need to define the email address from where we are going to send the email to the user. So there's going to be var from, is equal to new EmailAddress. Let us import the necessary namespace which is the SendGrid one. So SendGrid.helpers.mail. These takes two parameters. The first one is…

Contents