File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ public sealed class MailOptions
77{
88 public const string SectionName = "OpenShock:Mail" ;
99 public const string SenderSectionName = SectionName + ":Sender" ;
10- public const string SenderOptionName = "EmailSender" ;
1110
1211 [ Required ]
1312 public required MailType Type { get ; init ; }
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ public static WebApplicationBuilder AddEmailService(this WebApplicationBuilder b
3737
3838 private static WebApplicationBuilder AddSenderContactConfiguration ( this WebApplicationBuilder builder )
3939 {
40- builder . Services . Configure < Contact > ( MailOptions . SenderSectionName ,
40+ builder . Services . Configure < MailOptions . MailSenderContact > ( MailOptions . SenderSectionName ,
4141 builder . Configuration . GetRequiredSection ( MailOptions . SectionName ) ) ;
4242 return builder ;
4343 }
Original file line number Diff line number Diff line change @@ -24,18 +24,18 @@ public sealed class SmtpEmailService : IEmailService
2424 /// DI Constructor
2525 /// </summary>
2626 /// <param name="templates"></param>
27- /// <param name="senderOptions "></param>
27+ /// <param name="sender "></param>
2828 /// <param name="options"></param>
2929 /// <param name="logger"></param>
3030 public SmtpEmailService (
3131 SmtpServiceTemplates templates ,
32- IOptionsSnapshot < Contact > senderOptions ,
32+ IOptions < MailOptions . MailSenderContact > sender ,
3333 IOptions < SmtpOptions > options ,
3434 ILogger < SmtpEmailService > logger
3535 )
3636 {
3737 _templates = templates ;
38- _sender = senderOptions . Get ( MailOptions . SenderOptionName ) . ToMailAddress ( ) ;
38+ _sender = sender . Value . ToMailAddress ( ) ;
3939 _options = options . Value ;
4040 _logger = logger ;
4141
You can’t perform that action at this time.
0 commit comments