您可以使用MailDefinition类。
这是您的用法:
MailDefinition md = new MailDefinition();md.From = "test@domain.com";md.IsBodyHtml = true;md.Subject = "Test of MailDefinition";ListDictionary replacements = new ListDictionary();replacements.Add("{name}", "Martin");replacements.Add("{country}", "Denmark");string body = "<div>Hello {name} You're from {country}.</div>";MailMessage msg = md.CreateMailMessage("you@anywhere.com", replacements, body, new System.Web.UI.Control());


