add application name as metadata to mail message

This commit is contained in:
2026-03-09 12:16:48 +01:00
parent b472602409
commit e3a46f36b4
+4
View File
@@ -1,5 +1,6 @@
using Microsoft.Extensions.Logging;
using System.Net.Mail;
using System.Reflection;
using System.Text;
namespace zero.Mails;
@@ -76,6 +77,9 @@ public class MailProvider : IMailProvider
message.BodyEncoding = encoding;
message.Preheader = TokenReplacement.Apply(message.Preheader, message.Placeholders);
string appName = Zero.Options.AppName.Or(Assembly.GetEntryAssembly()?.GetName().Name);
message.Metadata.Add("application", appName);
if (!message.HasView || message.Body.HasValue())
{
message.IsRendered = true;