public void SendEmail()
{
var path = Path.Combine(Server.MapPath("../"), "Content\\template\\email\\eCalendar.html");
var template = System.IO.File.ReadAllText(path);
var body = template.Replace("{{Name}}", "")
.Replace("{{Type}}", "")
.Replace("{{Description}}", "")
.Replace("{{Subject}}", "");
string smtpServer = "Lamb.corning.com";
int smtpPort = 25;
SmtpClient smtp = new SmtpClient(smtpServer, smtpPort);
Email.DefaultSender = new SmtpSender(smtp);
var result = Email.From("MTE OA(DO NOT REPLY) <[email protected]>")
.To("[email protected]")
//.CC("[email protected]")
.Subject("邮件主题")
.Body(body, true)
.Send();
}
标签:Replace,发送,corning,template,var,com,邮件
From: https://www.cnblogs.com/duixue/p/18348767