refactor: 格式化邮件正文内容
This commit is contained in:
parent
b02d5ad53c
commit
181fd03e17
|
@ -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>
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue