我正在将确认邮件发送到带有此URL的注册表

http://blogs.microsoft.co.il/blogs/shair/archive/2011/12/06/email-confirmation-asp-net-mvc-web-application.aspx#comments

但是我遇到了错误。任何人都可以帮助我。

message.Subject = "Please Verify your Account";
MailBody.Append("<html><table cellpadding='0' cellspacing='0' width='100%' align='center'>" + "<tr><td><p>Dear " + user.UserName+ "</p><br>");
MailBody.Append("To verify your account, please click the following link:<span style='font-weight:bold;'> <a href=verifyUrl + "\" target="http://localhost:51819">" + verifyUrl + "+"</a></span> to complete your registration.<br>);

最佳答案

您在第二个附录中缺少引号。脚本荧光笔甚至显示错误。

如果要在字符串中使用双引号,则需要对其进行转义,例如\“

所以你第二次追加应该是这样的

  MailBody.Append("To verify your account, please click the following link:<span style='font-weight:bold;'><a href=\""
    + verifyUrl + "\" target=\"http://localhost:51819\">"
    + verifyUrl + "</a></span> to complete your registration.<br>");

关于c# - 确认邮件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13968921/

10-09 03:12