Interface IEmailService
- Namespace
- Builvero.Application.Interfaces.Services
- Assembly
- Builvero.Application.dll
Defines the contract for sending email verification codes to users.
public interface IEmailService
Remarks
This interface provides methods for sending email verification codes during user registration or email verification workflows. The implementation uses SendGrid for email delivery.
Methods
SendVerificationCodeAsync(string, string, string, string, CancellationToken)
Sends an email verification code to a user's email address.
Task SendVerificationCodeAsync(string email, string code, string fullName, string verifyUrl, CancellationToken cancellationToken = default)
Parameters
emailstringThe recipient email address. Must be a valid email format.
codestringThe 6-digit verification code to send.
fullNamestringThe recipient's full name for personalization.
verifyUrlstringThe link the user should click to verify their email.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task
- Defines the contract for sending email verification codes to users.
Remarks
The email includes:
- Subject: "Verify your Builvero account"
- HTML content with the verification code
- Plain text fallback with the verification code
- Expiration notice (15 minutes)
If the SendGrid API key is not configured, a warning is logged and the method returns without throwing an exception (allows the application to continue in development/test environments).
Exceptions
- Exception
Thrown when SendGrid API key is not configured or email sending fails.