尝试构建代码以通过电子邮件发送密码重设链接以响应请求密码的人。 电子邮件是通过hotmail和gmail接收的,但不是通过特定的邮件客户端接收的,我不知道配置。 当然,我尝试了一些有关引号和双引号的安排,但没有给出任何内容。
<?php
$site = "http://www.example.fr";
$from = "info@example.fr";
$nom = "DLSS";
$limite = "_----------=_parties_".md5(uniqid (rand()));
$sujet = "Password Reset";
$text = "Please click on this <a href=\"http://www.example.fr/dlss/login/verif.php?eml=".$eml."&cod=".$cod."\">link</a> to initialize your password.";
$html = "Please click on this <a href=\"http://www.example.fr/dlss/login/verif.php?eml=".$eml."&cod=".$cod."\">link</a> to initialize your password.";
$from = $nom." <".$from.">";
$header = "From: ".$from."\n";
$header .= "Reply-to: ".$from."\n";
$header .= "Return-Path: ".$from."\n";
$header .= "Organization: ".$nom."\n";
$header .= "X-Sender: <".$site.">\n";
$header .= "X-Mailer: PHP/".phpversion()."\n";
$header .= "X-auth-smtp-user: ".$from." \n";
$header .= "X-abuse-contact: ".$from." \n";
$header .= "Date: ".date("D, j M Y G:i:s O")."\n";
$header .= "MIME-Version: 1.0\n";
$header .= "Content-Type: multipart/alternative; boundary=\"".$limite."\"";
$message = "";
$message .= "--".$limite."\n";
$message .= "Content-Type: text/plain\n";
$message .= "charset=\"iso-8859-1\"\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= $text;
$message .= "\n\n--".$limite."\n";
$message .= "Content-Type: text/html; ";
$message .= "charset=\"iso-8859-1\"; ";
$message .= "Content-Transfer-Encoding: 8bit;\n\n";
$message .= $html;
$message .= "\n--".$limite."--";
mail($eml, $sujet, $message, $header);
?>
总而言之,当我在此处替换这两行时,此特定的邮件客户端会收到电子邮件:
$text = "Please click on this <a href=\"http://www.example.fr/dlss/login/verif.php?eml=".$eml."&cod=".$cod."\">link</a> to initialize your password.";
$html = "Please click on this <a href=\"http://www.example.fr/dlss/login/verif.php?eml=".$eml."&cod=".$cod."\">link</a> to initialize your password.";
这里有这两行:
$text = "Test Email with link. <a href=\"http://www.example.fr\">link</a>";
$html = "Test Email with link. <a href=\"http://www.example.fr\">link</a>";
或在此处有这两行:
$text = $eml . " - " . $cod;
$html = $eml . " - " . $cod;
最后,问题在于这两个部分(网址和两个变量)的组合,我已经三天时间尝试解决此问题,但我不能独自解决,这真的很不错有帮助,在此先谢谢您!