Skip to content

Commit

Permalink
Set default "from" on notification model (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ljutyj authored Dec 24, 2024
1 parent 7bebd4a commit 88b3b8a
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ public async Task SendNotificationAsync(NotificationMessage message)
var emailNotificationMessage = message as EmailNotificationMessage
?? throw new ArgumentException($"The message is not {nameof(EmailNotificationMessage)} type");

emailNotificationMessage.From ??= _emailSendingOptions.DefaultSender;

try
{
var graphMessage = new Message
{
Subject = emailNotificationMessage.Subject,
Body = new ItemBody { ContentType = BodyType.Html, Content = emailNotificationMessage.Body },
From = NewRecipient(emailNotificationMessage.From ?? _emailSendingOptions.DefaultSender),
From = NewRecipient(emailNotificationMessage.From),
ToRecipients = [NewRecipient(emailNotificationMessage.To)],
CcRecipients = emailNotificationMessage.CC?.Select(NewRecipient).ToList() ?? [],
BccRecipients = emailNotificationMessage.BCC?.Select(NewRecipient).ToList() ?? []
Expand Down

0 comments on commit 88b3b8a

Please sign in to comment.