feat(application): add ToSender helper for email accounts
Adds GetEmailAccountQueryExtensions.ToSender to build a sender query from an email address, and documents its use on PublishEmailViaSmtpCommand.Sender.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
#if NET
|
||||
using DigitalData.MessagingService.Application.EmailAccounts.Queries;
|
||||
|
||||
namespace DigitalData.MessagingService.Application.EmailSending.Commands;
|
||||
|
||||
public static class GetEmailAccountQueryExtensions
|
||||
{
|
||||
public static GetEmailAccountQuery ToSender(string emailAddress)
|
||||
{
|
||||
return new GetEmailAccountQuery
|
||||
{
|
||||
Username = emailAddress
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -17,6 +17,10 @@ namespace DigitalData.MessagingService.Application.EmailSending.Commands;
|
||||
/// </summary>
|
||||
public record PublishEmailViaSmtpCommand : IRequest<Guid>
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the sender's email account to resolve, identified by either its Id or Username.
|
||||
/// Use <see cref="GetEmailAccountQueryExtensions.ToSender(string)"/> to create a query from an email address.
|
||||
/// </summary>
|
||||
public required GetEmailAccountQuery Sender { get; init; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user