Skip to content

Commit

Permalink
Merge pull request #64 from Rodrigo-Cardoso/issue-63-smtp-configurati…
Browse files Browse the repository at this point in the history
…on-fix

fix-issue-63
  • Loading branch information
d4nt authored May 17, 2019
2 parents be5b403 + 3022bc5 commit 1feee01
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Web/Services/MessageServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public void SendMail(MimeMessage message)
client.Connect(_config.GetValue<string>("Email:SmtpHost"), _config.GetValue<int>("Email:SmtpPort"), _config.GetValue<bool>("Email:UseSSL"));

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

client.Send(message);
client.Disconnect(true);
Expand Down
3 changes: 2 additions & 1 deletion Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"SmtpUser": "",
"SmtpPassword": "",
"SenderAddress": "",
"UseSSL": false
"UseSSL": false,
"UseAuthentication": true
},
"Logging": {
"IncludeScopes": false,
Expand Down
3 changes: 2 additions & 1 deletion docs/mail.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Example:
"SmtpUser": "[email protected]",
"SmtpPassword": "yourgmailpassword",
"SenderAddress": "Sender Name <[email protected]>",
"UseSSL": true
"UseSSL": true,
"UseAuthentication": true
}
```

Expand Down

0 comments on commit 1feee01

Please sign in to comment.