出于某種奇怪的原因,我的 PHP 登錄系統(tǒng)會(huì)發(fā)送一封確認(rèn)電子郵件來激活您的帳戶,但它不會(huì)發(fā)送任何內(nèi)容。<?php$error = NULL;require "phpmailer/class.phpmailer.php";require "phpmailer/class.smtp.php";require "phpmailer/PHPMailerAutoload.php";if(isset($_POST['submit'])) { //Form Data GET $u = $_POST['u']; $p = $_POST['p']; $p2 = $_POST['p2']; $e = $_POST['e']; //Throw Username too short error if(strlen($u) < 5){ $error = "(!) Your username must be at least 5 characters."; }elseif($p2 != $p) { //Throw password pair error. $error .= "(!) Your passwords do not match :/"; }else{ //200 [OK] //Establish Connection to Database $mysqli = NEW MySQLi('localhost','root','','test'); //Convert special chars. $u = $mysqli->real_escape_string($u); $p = $mysqli->real_escape_string($p); $p2 = $mysqli->real_escape_string($p2); $e = $mysqli->real_escape_string($e); //Generate Verification Key $vkey = md5(time().$u); //Insert account into database $p = md5($p); $insert = $mysqli->query("INSERT INTO accounts(username,password,email,vkey) VALUES('$u','$p','$e','$vkey')"); if($insert){ //Start PHPMailer $mail = new PHPMailer(true); $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPDebug = 0; //No Debug. Set to 3 for verbose logging. $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = "ssl"; //Set to SSL to pass checks. $mail->Host = "smtp.mail.com"; //Set to mail.com server, it has ssl, smtp, and it's free. If you'd like to use gmail, use smtp.gmail.com $mail->Port = 465; //SSL/TLS Port for mail.com and gmail.com一開始,我需要我的 PHPMailer 文件夾中的文件,然后我啟動(dòng) PHPMailer這讓我很緊張。我知道問題所在。如果有人知道解決方案或知道為什么它不起作用的提示,那就太好了。謝謝。同一文件中的 HTML
1 回答

阿波羅的戰(zhàn)車
TA貢獻(xiàn)1862條經(jīng)驗(yàn) 獲得超6個(gè)贊
你可以試試這個(gè)我也有一個(gè)錯(cuò)誤所以我不得不在主機(jī)之前添加這一行
$mail->SMTPOptions=array('ssl'=>array('verify_peer'=>false,'verify_peer_name'=>false,'allow_self_signed'=>false));
但如果這不起作用,您可以嘗試像這樣進(jìn)行故障排除
if($mail->Send()){
}else{
var_dump($mail);
die();
}
所以一旦你得到你的錯(cuò)誤日志,你可能可以做一個(gè)谷歌或粘貼你的錯(cuò)誤日志,也許我們可以提供幫助
- 1 回答
- 0 關(guān)注
- 109 瀏覽
添加回答
舉報(bào)
0/150
提交
取消