refactor: 格式化邮件正文内容

This commit is contained in:
Argo Zhang 2020-02-25 15:39:15 +08:00
parent b02d5ad53c
commit 181fd03e17
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
2 changed files with 3 additions and 3 deletions

View File

@ -24,7 +24,7 @@ namespace Bootstrap.Client.Controllers.Api
[HttpPost]
public async Task<bool> Log([FromServices]IConfiguration config, [FromBody]string message)
{
return await SendMailAsync(config, "BootstrapAdmin Exception", message);
return await SendMailAsync(config, "BootstrapAdmin Exception", message.Replace("\r\n", "<br>").Replace("\n", "<br>"));
}
/// <summary>

View File

@ -67,7 +67,7 @@ namespace Bootstrap.Client.Extensions
var rowData = new StringBuilder();
foreach (var row in data.GetProperty("Data").EnumerateObject())
{
rowData.AppendFormat(trTemplate, row.Name, row.Value.GetRawText());
rowData.AppendFormat(trTemplate, row.Name, row.Value.GetRawText().Replace("\\r\\n", "<br>").Replace("\\n", "<br>"));
}
sb.Append(string.Format(itemTemplate, cate[itemName], data.GetProperty("Duration").GetString(), state[data.GetProperty("Status").GetRawText()], rowData.ToString()));
}
@ -209,7 +209,7 @@ namespace Bootstrap.Client.Extensions
}
// 合并消息
content.AppendLine(msg.Message.Replace("\\r\\n", "<br>").Replace("\\n", "<br>").Replace("\r\n", "<br>").Replace("\n", "<br>"));
content.AppendLine(msg.Message);
}
if (sender != null && mail != null)
{