Services
If you have not read it yet, start with Introduction.
Your application code depends on IEmailService when it needs to send an email. DevKit registers a default implementation at runtime; you only work against this interface.
The contract is defined in IEmailService.cs in the Application layer:
// Copyright (c) CodeBlock.Dev. All rights reserved.
// For more information visit https://codeblock.dev
namespace CodeBlock.DevKit.Application.Services;
/// <summary>
/// Service interface for sending email messages.
/// Provides email delivery functionality for notifications and communications.
/// </summary>
public interface IEmailService
{
/// <summary>
/// Sends an email message to the specified recipient.
/// </summary>
/// <param name="to">The email address of the recipient.</param>
/// <param name="subject">The subject line of the email.</param>
/// <param name="body">The content body of the email.</param>
/// <param name="isBodyHtml">Whether the body content is HTML format (default: true).</param>
/// <returns>A task representing the asynchronous email sending operation.</returns>
Task Send(string to, string subject, string body, bool isBodyHtml = true);
}
to— Recipient address (for example[email protected]).subject— Subject line shown in the recipient’s mail client.body— Message body; can be plain text or HTML depending onisBodyHtml.isBodyHtml— Whentrue(the default),bodyis treated as HTML.
Inject IEmailService in handlers, Blazor components, or API endpoints the same way you inject other application services.
Whether a message is actually sent still depends on Settings (email enabled, valid provider configuration); see Configuration and Settings — Tutorials: Email.