Я пытаюсь отправить электронное письмо через контроллер MVC, используя свойство MailItem.HTMLBody, которое легко отправляется, но когда я пытаюсь добавить некоторый атрибут html и класс, он не применяется к содержанию основного письма, я хочу отправить это в свое электронное письмо. содержание тела
[Image: https://i.stack.imgur.com/IAkMU.jpg
Код контроллера
var GetProgramM = corporate.FindProgramM(GetTeam.teamid, "Program Management");
if (GetProgramM.email != null)
{
brief.EmailsentprogramManagemnet = 1;
briefRepo.AddRecord(brief);
briefRepo.savechanges();
string from = ConfigurationManager.AppSettings["SMTPuser"];
string host = ConfigurationManager.AppSettings["Host"];
int port = int.Parse(ConfigurationManager.AppSettings["EmailPort"]);
bool enableSsl = Convert.ToBoolean(ConfigurationManager.AppSettings["EnableSSL"]);
string user = ConfigurationManager.AppSettings["SMTPuser"];
string password = ConfigurationManager.AppSettings["SMTPpassword"];
string email = GetProgramM.email;
var mailmessage = new MimeMessage();
mailmessage.From.Add(new MailboxAddress("SHARP", from));
mailmessage.To.Add(new MailboxAddress("Not Reply", email));
mailmessage.Subject = "Request For Document Approval";
var body = new BodyBuilder();
var project1 = projectrepo.GetAll().Where(x => x.NewProject_Id == brief.NewProject_Id).FirstOrDefault();
string projectname = project1.Project_Title;
string author = brief.author;
string link = Url.Action("ProgramMapprovalView", "ProjectBrief", new System.Web.Routing.RouteValueDictionary(new { id = brief.ProjectBriedId }), "http", Request.Url.Host);
//// see plus image
var pathImage = Path.Combine(Server.MapPath("~/content/seepulse.png"));
var image = body.LinkedResources.Add(pathImage);
image.ContentId = MimeUtils.GenerateMessageId();
var pathImage1 = Path.Combine(Server.MapPath("~/content/mandate-email.jpg"));
var image1 = body.LinkedResources.Add(pathImage1);
image1.ContentId = MimeUtils.GenerateMessageId();
body.HtmlBody = string.Format(@"<center><img src=""cid:{0}"" alt=""Invite""><b><h4>{1} requested for approval of Project Brief document</h4></b><br>Your Project:<b>{2}</b><br>Starting Up Stage:<b>{3}</b><br><br><a href= ""{4}"" > <img src=""cid:{5}"" alt=""Invite""> </a></center>", image1.ContentId, author, projectname, "Starting Up Project", link, image.ContentId);
mailmessage.Body = body.ToMessageBody();
var smtp = new SmtpClient();
smtp.Connect(host, port);
smtp.AuthenticationMechanisms.Remove("XOAUTH2");
smtp.Authenticate(user, password);
smtp.Send(mailmessage);
smtp.Disconnect(true);
}