ASP.NET应用程序发送的邮件带有超链接应用程序、超链接、邮件、ASP

2023-09-05 00:21:23 作者:煙de菋檤

  MailMessage消息=新MailMessage();
message.From =新MailAddress(hkar@gmail.com);

message.Subject =主题;
message.Body =请登录;
SmtpClient SMTP =新SmtpClient();

message.To.Add(karaman@gmail.com);
smtp.Send(消息);
 

我希望在发送邮件的身体它说:登录的超链接。我该怎么办呢?

解决方案

  message.Body =请< A HREF = \http://www.example.com/login的.aspx \>登录< / A>中;
 

请确保您在发送内容是HTML虽然突出。

  message.IsBodyHTML = TRUE;
 
一个应用程序文件不能以电子邮件的形式发送给别人.这道题对吗

MailMessage message = new MailMessage();
message.From = new MailAddress("hkar@gmail.com");

message.Subject = "Subject";
message.Body = "Please login";
SmtpClient smtp = new SmtpClient();

message.To.Add("karaman@gmail.com");                  
smtp.Send(message);

I want to have a hyperlink in the body of sent mail where it says "login". How can I do that?

解决方案

message.Body = "Please <a href=\"http://www.example.com/login.aspx\">login</a>";

Make sure you highlight when sending that the content is HTML though.

message.IsBodyHTML = true;