File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
src/DevBetterWeb.Infrastructure/Services Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -20,18 +20,20 @@ public Smtp2GoEmailService(IOptions<ApiMailSenderOptions> optionsAccessor)
2020 _httpClient = new HttpClient ( ) ;
2121 }
2222
23-
24- public async Task SendEmailAsync ( string email , string subject , string message )
23+ public ApiMailSenderOptions Options { get ; }
24+ public async Task SendEmailAsync ( string email , string subject , string message )
2525 {
2626 if ( string . IsNullOrEmpty ( Options . ApiKey ) ) throw new Exception ( "SMTP API Key not set." ) ;
2727 if ( string . IsNullOrEmpty ( Options . ApiBaseUrl ) ) throw new Exception ( "SMTP API Base URL not set." ) ;
2828 if ( string . IsNullOrEmpty ( Options . Sender ) ) throw new Exception ( "SMTP Sender not set." ) ;
2929
30- request . Headers . Add ( "Authorization" , $ "Bearer { Options . ApiKey } ") ;
30+ var request = new HttpRequestMessage ( HttpMethod . Post , Options . ApiBaseUrl . TrimEnd ( '/' ) + "/email/send" ) ;
31+ request . Headers . Add ( "Authorization" , $ "Bearer { Options . ApiKey } ") ;
3132
3233 var payload = new
3334 {
34- to = new [ ] { email } ,
35+ sender = Options . Sender ,
36+ to = new [ ] { email } ,
3537 subject = subject ,
3638 text_body = message ,
3739 html_body = message
You can’t perform that action at this time.
0 commit comments