[邮件发送,配置动态公司名称]

This commit is contained in:
2024-02-22 14:02:51 +08:00
parent 9c26745c2a
commit b7d9009ff4
7 changed files with 33 additions and 14 deletions
@@ -8,6 +8,7 @@ using AutoMapper;
using IRaCIS.Application.Contracts;
using Microsoft.Extensions.Options;
using Medallion.Threading;
using System.Text.RegularExpressions;
namespace IRaCIS.Application.Services
{
@@ -82,6 +83,12 @@ namespace IRaCIS.Application.Services
_distributedLockProvider = distributedLockProvider;
}
private string ReplaceCompanyName(string needDealtxt)
{
return needDealtxt.Replace("{*}", _userInfo.IsEn_Us ? _systemEmailConfig.CompanyName : _systemEmailConfig.CompanyNameCN);
}
//重置邮箱
public async Task SendMailEditEmail(Guid userId, string userName, string emailAddress, int verificationCode)
{
@@ -112,7 +119,7 @@ namespace IRaCIS.Application.Services
var templateInfo = SourceReader.ReadToEnd();
builder.HtmlBody = string.Format(templateInfo,
builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo),
//---尊敬的
_localizer["Mail_Dear", userName],
@@ -179,7 +186,7 @@ namespace IRaCIS.Application.Services
var templateInfo = SourceReader.ReadToEnd();
builder.HtmlBody = string.Format(templateInfo,
builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo),
"",
//---您正在进行邮箱重置密码操作
_localizer["Mail_ResettingPassword"],
@@ -247,7 +254,7 @@ namespace IRaCIS.Application.Services
var templateInfo = SourceReader.ReadToEnd();
builder.HtmlBody = string.Format(templateInfo,
builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo),
"",
//---您正在参与展影医疗IRC项目
_localizer["Mail_IRCProject"],
@@ -314,7 +321,7 @@ namespace IRaCIS.Application.Services
var templateInfo = SourceReader.ReadToEnd();
builder.HtmlBody = string.Format(templateInfo,
builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo),
"",
//---您正在参与展影医疗IRC项目中心调研工作
_localizer["Mail_CenterResearchReminder"],
@@ -403,7 +410,7 @@ namespace IRaCIS.Application.Services
var templateInfo = SourceReader.ReadToEnd();
builder.HtmlBody = string.Format(templateInfo,
builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo),
sysUserInfo.FullName,
sysUserInfo.UserName,
sysUserInfo.UserTypeRole.UserTypeShortName,
@@ -450,7 +457,7 @@ namespace IRaCIS.Application.Services
var templateInfo = SourceReader.ReadToEnd();
builder.HtmlBody = string.Format(templateInfo,
builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo),
sysUserInfo.FullName,
sysUserInfo.UserName,
sysUserInfo.UserTypeRole.UserTypeShortName,
@@ -512,7 +519,7 @@ namespace IRaCIS.Application.Services
var redirectUrl = $"{domain}/api/User/UserRedirect?url={System.Web.HttpUtility.UrlEncode(routeUrl)}";
builder.HtmlBody = string.Format(templateInfo,
builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo),
sysUserInfo.FullName,
trialInfo.ExperimentName,
trialInfo.ResearchProgramNo,
@@ -574,7 +581,7 @@ namespace IRaCIS.Application.Services
var redirectUrl = $"{domain}/api/User/UserRedirect?url={System.Web.HttpUtility.UrlEncode(routeUrl)}";
builder.HtmlBody = string.Format(templateInfo,
builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo),
sysUserInfo.FullName,
trialInfo.ExperimentName,
trialInfo.ResearchProgramNo,
@@ -696,7 +703,7 @@ namespace IRaCIS.Application.Services
var redirectUrl = $"{domain}/api/User/UserRedirect?url={System.Web.HttpUtility.UrlEncode(routeUrl)}";
builder.HtmlBody = string.Format(templateInfo,
builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo),
sysUserInfo.FullName,
trialInfo.ExperimentName,
trialInfo.ResearchProgramNo,