<develop>:(ShopERP 端)<无> 找回密码,增加 发送邮件的功能。

parent ac0c7c75
...@@ -9,14 +9,14 @@ namespace CoreCms.Net.Model.ViewModels.Email ...@@ -9,14 +9,14 @@ namespace CoreCms.Net.Model.ViewModels.Email
public class MailConfiguration public class MailConfiguration
{ {
public string SmtpServer { get; set; } = string.Empty; public string SmtpServer { get; set; } = string.Empty;
public int SmtpPort { get; set; } = 587; public int SmtpPort { get; set; } = 465;
public string UserName { get; set; } = string.Empty; public string UserName { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty; public string Password { get; set; } = string.Empty;
public string DisplayName { get; set; } = "System Notification"; public string DisplayName { get; set; } = "System Notification";
public bool EnableSsl { get; set; } = true; public bool EnableSsl { get; set; } = true;
public string FromAddress { get; set; } = string.Empty; public string FromAddress { get; set; } = string.Empty;
public int Timeout { get; set; } = 10000; // 10 seconds public int Timeout { get; set; } = 10000; // 10 seconds
public bool UseDefaultCredentials { get; set; } = false; public bool UseDefaultCredentials { get; set; } = true;
} }
/// <summary> /// <summary>
......
...@@ -55,12 +55,10 @@ namespace CoreCms.Net.Utility.Helper ...@@ -55,12 +55,10 @@ namespace CoreCms.Net.Utility.Helper
catch (SmtpException ex) catch (SmtpException ex)
{ {
_logger?.LogError(ex, $"SMTP error sending email: {ex.Message}"); _logger?.LogError(ex, $"SMTP error sending email: {ex.Message}");
throw; // Rethrow to allow caller handling
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger?.LogError(ex, $"Error sending email: {ex.Message}"); _logger?.LogError(ex, $"Error sending email: {ex.Message}");
throw;
} }
} }
...@@ -84,7 +82,7 @@ namespace CoreCms.Net.Utility.Helper ...@@ -84,7 +82,7 @@ namespace CoreCms.Net.Utility.Helper
var mail = new MailMessage var mail = new MailMessage
{ {
From = new MailAddress(fromAddress, _config.DisplayName), From = new MailAddress(fromAddress),
Subject = model.Subject ?? "[No Subject]", Subject = model.Subject ?? "[No Subject]",
Body = model.Body ?? string.Empty, Body = model.Body ?? string.Empty,
IsBodyHtml = model.IsBodyHtml, IsBodyHtml = model.IsBodyHtml,
......
...@@ -365,6 +365,7 @@ namespace CoreCms.Net.Web.Admin.Controllers ...@@ -365,6 +365,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
</body> </body>
</html> </html>
""", """,
IsBodyHtml = true IsBodyHtml = true
}; };
......
...@@ -6,12 +6,11 @@ ...@@ -6,12 +6,11 @@
// Mysql数据库链接字符串,请保持后面的属性别少。经过测试,mysql版本需要5.7或以上 // Mysql数据库链接字符串,请保持后面的属性别少。经过测试,mysql版本需要5.7或以上
}, },
"Smtp": { "Smtp": {
"Server": "smtp.exmail.qq.com", "Server": "smtp.qiye.aliyun.com",
"Port": 465, "Port": 465,
"Username": "erpservice@geekbuy.com", "Username": "erpservice@geekbuy.com",
"Password": "co69W7xEZ6qjBo01", "Password": "co69W7xEZ6qjBo01",
"FromAddress": "erpservice@geekbuy.com", "FromAddress": "erpservice@geekbuy.com"
"DisplayName": "My Application"
}, },
//定时任务管理面板的账户密码 //定时任务管理面板的账户密码
"HangFire": { "HangFire": {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// Mysql数据库链接字符串,请保持后面的属性别少。经过测试,mysql版本需要5.7或以上 // Mysql数据库链接字符串,请保持后面的属性别少。经过测试,mysql版本需要5.7或以上
}, },
"Smtp": { "Smtp": {
"Server": "smtp.exmail.qq.com", "Server": "smtp.qiye.aliyun.com",
"Port": 465, "Port": 465,
"Username": "erpservice@geekbuy.com", "Username": "erpservice@geekbuy.com",
"Password": "co69W7xEZ6qjBo01", "Password": "co69W7xEZ6qjBo01",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment