email refacts trying to use creds

+ Admin user deletion from user list
+ Admin send email confirmation message from user list
+ WebSocket minor change
This commit is contained in:
2019-03-07 10:45:11 +00:00
parent 74302457e9
commit 06041f1405
17 changed files with 242 additions and 90 deletions

View File

@ -1,4 +1,5 @@
using System;
using System.Net;
using System.Threading.Tasks;
using MailKit.Net.Smtp;
using MailKit.Security;
@ -61,7 +62,13 @@ namespace Yavsc.Services
sc.Connect(
smtpSettings.Host,
smtpSettings.Port,
SecureSocketOptions.None);
SecureSocketOptions.Auto);
if (smtpSettings.UserName!=null) {
NetworkCredential creds = new NetworkCredential(
smtpSettings.UserName, smtpSettings.Password, smtpSettings.Host);
await sc.AuthenticateAsync(System.Text.Encoding.UTF8, creds, System.Threading.CancellationToken.None);
}
await sc.SendAsync(msg);
model.MessageId = msg.MessageId;
model.Sent = true; // a duplicate info to remove from the view model, that equals to MessageId == null