我正在使用此 URL 向注册机发送确认邮件
但是我遇到了错误。任何人都可以帮助我。
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>");
