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 attachment using SendGrid

Send an attachment using SendGrid - ASP.NET Core Tutorial

From the course: ASP.NET Core: Communication Management

Start my 1-month free trial

Send an attachment using SendGrid

- [Instructor] It's a common practice to attach either a file, or a document in general, when you send an email. But how can we attach a document to an email sent via SendGrid? Well, let's go to Visual Studio and see it in action. In here, go to solution explorer then go to data, view models, and ComposeEmailVM. VM stands for view model. In here, we are going to add a new property that we are going to use for the file upload. So, public, IFormFile, and the name is going to be attachment, then get and set. So let us import the IFormFile. And the reference, or the namespace, is the Microsoft.AspNetCore.Http. Let us save the changes. Now let us go to the view. So solution explorer, then go to views, home, and Compose dot C sharp HTML. In here, scroll down. Just before the submit button, we are going add a new form group. So I'll just copy these lines and paste them in here. Remove the label and the text area,…

Contents