我正在为我想做的网站做一个重置密码,好吧我正在尝试将HTML“A”标签插入我的$message
变量并在我发送给的电子邮件中显示它将成为一个链接
例如:
$to = $torecoveremail;
$subject = "You Forgot Your Password At: " . $title;
$message = "
Your Username: " . $recoverusername . "
Your Email: " . $recoveruseremail . "
Your First Name: " . $recoveruserfname . "
Your Last Name: " . $recoveruserlname . "
Reset Password Follow This Link:
<a href=\"yourphotomake.info/shiylohs/cms/admin432/passreset.php?id=" . $passresetid . "\">Reset Password</a> ";
mail($to, $subject, $message);
并且发送的电子邮件中的输出是:
Your Username: ben
Your Email: ben@tvstartup.com
Your First Name: ben
Your Last Name: ben
Reset Password Follow This Link:
<a href="yourphotomake.info/shiylohs/cms/admin432/passreset.php?id=15">Reset Password</a>
我想要的电子邮件是:
Your Username: ben
Your Email: ben@tvstartup.com
Your First Name: ben
Your Last Name: ben
Reset Password Follow This Link:
Reset Password
非常感谢
答案 0 :(得分:2)
确保在第4个参数中包含Content-Type成员。请参阅以下示例(稍微修改自php.net/mail):
Note:
If intending to send HTML or otherwise Complex mails, it is recommended to use the PEAR package » PEAR::Mail_Mime.
还在PHP.net上注明:
titleLabel
答案 1 :(得分:1)
您已指定标题。
$to = $torecoveremail;
$subject = "You Forgot Your Password At: " . $title;
$headers = "From: bob@example.com\r\n";
$headers .= "CC: bob@example.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = '<html><body>';
$message .= '<p>Your Username: ben</p>';
$message .= '<p>Your Email: ben@tvstartup.com</p>';
$message .= '<p>Your First Name: ben</p>';
$message .= '<p>Your Last Name: ben</p>';
$message .= '<p>Reset Password Follow This Link:</p>';
$message .= '<p><a href="yourphotomake.info/shiylohs/cms/admin432/passreset.php?id=15">Reset Password</a></p>';
$message .= '</body></html>';
mail($to, $subject, $message, $headers);
有关更多选项,请使用PHPMAILER。它非常有用。