我有一个运行良好的基本 SendMail 方法,使用 System.Net.Mail 并希望获得一些关于如何使用超链接发送它的建议
大意的东西
labTester.Text = <p>Please <a href='#'>Click here</a>if you haven't received a mail
这是我一直使用的邮件方法
protected static void SendMail(string firstName, string lastName, string email, string password)
{
MailMessage mailMessage = new MailMessage();
mailMessage.From = new MailAddress("YourMail@lr.co.za", "Visuals");
mailMessage.To.Add(email);
mailMessage.Subject = "Thank you for registering!";
//mailMessage.Body = "<html><body><div style=\"font-family:arial;font-size:12px\"><p>Dear " + firstName + " " + lastName + "</p><p>Your details are as follows:<ul><li><b>User Name:</b> " + email + "</li><li><b>Password:</b> " + password + "</li></ul><p>To complete The Registration,<a href=\"http://www.lrvisuals.co.za/LoginUser.aspx?IsApproved=Yes&userName="+firstName+"'>\">please click the following link</a></p></div></body></html>";
mailMessage.Body = "<html><body><div style=\"font-family:arial;font-size:12px\"><p>Dear " + firstName + " " + lastName + "</p><p>Your details are as follows:<ul><li><b>User Name:</b> " + email + "</li><li><b>Password:</b> " + password + "</li></ul><p>To complete The Registration,<a href=\"http://localhost:2482/LoginUser.aspx?IsApproved=Yes&userName=" + email + "'>\">please click the following link</a></p></div></body></html>";
mailMessage.IsBodyHtml = true;
SmtpClient mailSender = new SmtpClient(ConfigurationManager.AppSettings["smtpconn"]);
mailSender.Send(mailMessage);
}
是否甚至可以使用超链接执行方法(代码隐藏)