我使用此代码从我的网站发送电子邮件(摘自https://help.1and1.com/hosting-c37630/scripts-and-programming-languages-c85099/aspnet-c39624/send-an-e-mail-using-aspnet-a604246.html)
//create the mail message
MailMessage mail = new MailMessage();
//set the FROM address
mail.From = new MailAddress(from);
//set the RECIPIENTS
mail.To.Add(to);
//enter a SUBJECT
mail.Subject = subject;
//Enter the message BODY
mail.Body = body;
//set the mail server (default should be smtp.1and1.com)
SmtpClient smtp = new SmtpClient("smtp.1and1.com");
//Enter your full e-mail address and password
smtp.Credentials = new NetworkCredential("admin@blank.com", "Password");
//send the message
smtp.Send(mail);
发送的电子邮件不会生成html。因此,不是显示链接,而是链接的实际代码等。
我做错了什么?
答案 0 :(得分:4)
您必须添加以下行:
mail.IsBodyHtml = true;