我正在使用以下方法发送电子邮件。我希望能够用粗体文本格式化电子邮件。
前任。
出自: 姓名
电子邮件: 电子邮件地址
留言: 留言
我该怎么做?
protected void SendMail()
{
var fromAddress = "myemail@gmail.com";
var toAddress = "myotheremail@gmail.com";
const string fromPassword = "mypassword";
string subject = "New Email from Website";
string body = "From: " + name.Text + "\n";
body += "Email: " + email.Text + "\n";
body += "Message: \n" + message.Text + "\n";
var smtp = new System.Net.Mail.SmtpClient();
{
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.EnableSsl = true;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
smtp.Timeout = 20000;
}
// Passing values to smtp object
smtp.Send(fromAddress, toAddress, subject, body);
}