Commit 5dd9c7f5 by lcx

邮件发送添加配置

parent be83b464
......@@ -20,7 +20,8 @@
"EmailOptions": {
"SmtpServer": "smtpdm.aliyun.com",
"Account": "service@email.suvalue.com",
"Password": "SuValue123456"
"Password": "SuValue123456",
"IsEnable": true
},
"Application": {
//登录过期时间
......
......@@ -123,6 +123,13 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AllotController.Success(Performance.DtoModels.AllotRequest)">
<summary>
生成成功或归档绩效记录
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AllotController.Insert(Performance.DtoModels.AllotRequest)">
<summary>
新增绩效
......
......@@ -55,7 +55,7 @@ static void Main(string[] args)
var option = services.BuildServiceProvider().GetService<IOptions<EmailOptions>>();
services.AddEmailUtil(config => { config.Account = option.Value.Account; config.Password = option.Value.Password; config.SmtpServer = option.Value.SmtpServer; });
services.AddEmailUtil(config => { config.Account = option.Value.Account; config.Password = option.Value.Password; config.SmtpServer = option.Value.SmtpServer; config.IsEnable = option.Value.IsEnable; });
var emailService = services.BuildServiceProvider().GetService<IEmailService>();
var message = new EmailMessage
{
......
......@@ -20,7 +20,8 @@
"EmailOptions": {
"SmtpServer": "smtpdm.aliyun.com",
"Account": "service@email.suvalue.com",
"Password": "SuValue123456"
"Password": "SuValue123456",
"IsEnable": true
},
"Application": {
//登录过期时间
......
......@@ -22,7 +22,8 @@
"EmailOptions": {
"SmtpServer": "smtpdm.aliyun.com",
"Account": "service@email.suvalue.com",
"Password": "SuValue123456"
"Password": "SuValue123456",
"IsEnable": true
},
"Application": {
//登录过期时间
......
......@@ -25,6 +25,10 @@ public class EmailOptions
/// 密码
/// </summary>
public string Password { get; set; }
/// <summary>
/// 是否启用
/// </summary>
public bool IsEnable { get; set; }
}
......@@ -80,6 +84,9 @@ public Task<bool> SendAsync(EmailMessage message)
public bool Send(EmailMessage message)
{
if (!options.IsEnable)
return true;
MailMessage mail = new MailMessage();
try
{
......
......@@ -382,7 +382,7 @@ private void SendEmail(per_allot allot, string mail, int type, DateTime time)
$"您可以登录<a href=\"http://jixiao.suvalue.com\" target=\"_blank\">http://jixiao.suvalue.com</a>查看详细清空。</p>";
}
//emailService.SendAsync(message);
emailService.SendAsync(message);
}
/// <summary>
......
......@@ -937,7 +937,7 @@ private void SendEmail(string mail, string path, string subject, string body)
};
if (!string.IsNullOrEmpty(path))
message.Attachments = new List<string> { path };
//emailService.Send(message);
emailService.Send(message);
}
/// <summary>
......
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