To send emails using SendGrid, you can utilize the BlazorEmailRenderer along with the SendGrid client. Here’s an example of rendering and sending an email:

Example

var emailRenderer = new BlazorEmailRenderer(serviceProvider);
var emailHtml = await emailRenderer.RenderEmail<EmailTemplate>(emailParams =>
    emailParams.Add(x => x.EmailTitle, "Your Subject Here"));

// Send the rendered email using SendGrid
var client = new SendGridClient("<your_api_key>");
var from = new EmailAddress("your-email@example.com", "Your Name");
var to = new EmailAddress("recipient@example.com");
var msg = MailHelper.CreateSingleEmail(from, to, "Your Subject Here", null, emailHtml);
await client.SendEmailAsync(msg);