From 24f458bda45da5ee2d181a7d80658e532030af86 Mon Sep 17 00:00:00 2001 From: Yishimaocheng <505496523@qq.com> Date: Wed, 20 Nov 2019 18:53:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?SmtpClient=E8=8A=82=E7=82=B9=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0"Port"=E4=B8=8E"EnableSsl"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/Bootstrap.Client/appsettings.Development.json | 2 ++ src/client/Bootstrap.Client/appsettings.json | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/client/Bootstrap.Client/appsettings.Development.json b/src/client/Bootstrap.Client/appsettings.Development.json index 9e8fe519f..30955a4f9 100644 --- a/src/client/Bootstrap.Client/appsettings.Development.json +++ b/src/client/Bootstrap.Client/appsettings.Development.json @@ -48,6 +48,8 @@ }, "SmtpClient": { "Host": "smtp.163.com", + "Port": 587, + "EnableSsl": true, "Password": "", "From": "honeywell_mes@163.com", "To": "argo@163.com" diff --git a/src/client/Bootstrap.Client/appsettings.json b/src/client/Bootstrap.Client/appsettings.json index 427b72d9d..804532fe9 100644 --- a/src/client/Bootstrap.Client/appsettings.json +++ b/src/client/Bootstrap.Client/appsettings.json @@ -43,6 +43,8 @@ }, "SmtpClient": { "Host": "smtp.163.com", + "Port": 587, + "EnableSsl": true, "Password": "", "From": "honeywell_mes@163.com", "To": "argo@163.com" -- Gitee From 515334f18acb8ffd2a9608e31e2c81f5a543cd18 Mon Sep 17 00:00:00 2001 From: Yishimaocheng <505496523@qq.com> Date: Wed, 20 Nov 2019 18:55:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?Smtp=E5=A2=9E=E5=8A=A0=E9=87=87=E7=94=A8ssl?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E5=8F=91=E9=80=81=E9=82=AE=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bootstrap.Client/Controllers/Api/InterfaceController.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/Bootstrap.Client/Controllers/Api/InterfaceController.cs b/src/client/Bootstrap.Client/Controllers/Api/InterfaceController.cs index 30d336722..9a5f717b7 100644 --- a/src/client/Bootstrap.Client/Controllers/Api/InterfaceController.cs +++ b/src/client/Bootstrap.Client/Controllers/Api/InterfaceController.cs @@ -56,12 +56,16 @@ namespace Bootstrap.Client.Controllers.Api var password = section.GetValue("Password", ""); var from = section.GetValue("From", ""); var to = section.GetValue("To", ""); + var port = section.GetValue("Port", 25); + var enableSsl = section.GetValue("EnableSsl", false); if (!string.IsNullOrEmpty(password)) { using var mailSender = new SmtpClient(smtpHost) { - Credentials = new NetworkCredential(from, password) + Credentials = new NetworkCredential(from, password), + Port = port, + EnableSsl = enableSsl }; await mailSender.SendMailAsync(from, to, title, message); } -- Gitee