Skip to content

Commit 1feee01

Browse files
authored
Merge pull request #64 from Rodrigo-Cardoso/issue-63-smtp-configuration-fix
fix-issue-63
2 parents be5b403 + 3022bc5 commit 1feee01

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

Web/Services/MessageServices.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ public void SendMail(MimeMessage message)
3434
client.Connect(_config.GetValue<string>("Email:SmtpHost"), _config.GetValue<int>("Email:SmtpPort"), _config.GetValue<bool>("Email:UseSSL"));
3535

3636
// Note: only needed if the SMTP server requires authentication
37-
client.Authenticate(_config.GetValue<string>("Email:SmtpUser"), _config.GetValue<string>("Email:SmtpPassword"));
37+
if(_config.GetValue<bool>("Email:UseAuthentication")){
38+
client.Authenticate(_config.GetValue<string>("Email:SmtpUser"), _config.GetValue<string>("Email:SmtpPassword"));
39+
}
3840

3941
client.Send(message);
4042
client.Disconnect(true);

Web/appsettings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"SmtpUser": "",
66
"SmtpPassword": "",
77
"SenderAddress": "",
8-
"UseSSL": false
8+
"UseSSL": false,
9+
"UseAuthentication": true
910
},
1011
"Logging": {
1112
"IncludeScopes": false,

docs/mail.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Example:
1212
"SmtpUser": "[email protected]",
1313
"SmtpPassword": "yourgmailpassword",
1414
"SenderAddress": "Sender Name <[email protected]>",
15-
"UseSSL": true
15+
"UseSSL": true,
16+
"UseAuthentication": true
1617
}
1718
```
1819

0 commit comments

Comments
 (0)