The phpmailer local test prompts that the message is successfully sent, but you cannot receive it in your mailbox. please kindly advise, & lt ;? Php & nbsp; require_once ('class. phpmailer. php '); require_once ("class. smtp. php "); & nbsp; $ mail & phpmailer: the local test shows that the message is successfully sent, but the email cannot receive the message.
Could you give me some advice,
Require_once ('class. phpmailer. php ');
Require_once ("class. smtp. php ");
$ Mail = new PHPMailer ();
$ Mail-> CharSet = "UTF-8"; // sets the mail encoding, the default ISO-8859-1, which must be set to UTF-8 if you send Chinese
$ Mail-> IsSMTP (); // you can specify the SMTP service.
$ Mail-> SMTPAuth = true; // enable SMTP verification
$ Mail-> SMTPSecure = "ssl"; // SMTP Security Protocol
$ Mail-> Host = "smtp.163.com"; // SMTP server
$ Mail-> Port = 465; // SMTP server Port number
$ Mail-> Username = "123456@163.com"; // SMTP server Username
$ Mail-> Password = "123456"; // SMTP server Password
$ Mail-> SetFrom ('1970 @ 163.com ', '20160901'); // you can specify the sender address and name.
$ Mail-> AddReplyTo ("123456@163.com", "123456 ");
// Set the email reply recipient's address and name
$ Mail-> Subject = ''; // you can specify the mail title.
$ Mail-> AltBody = "to view this email, switch to an HTML-supported email client ";
// Optional, backward compatibility considerations
$ Mail-> MsgHTML ('Hello, simplified, traditional !!'); // Set the email content
$ Mail-> AddAddress ('1970 @ 163.com ', "123456 ");
$ Mail-> SMTPDebug = true;
// $ Mail-> AddAttachment ("images/phpmailer.gif"); // attachment
If (! $ Mail-> Send ()){
Echo "failed to send:". $ mail-> ErrorInfo;
} Else {
Echo "congratulations, the email is sent successfully! ";
}
?>
------ Solution --------------------
$ Mail-> Port = 465; // SMTP server Port number
Why not use port 25?
------ Solution --------------------
Comment out the two sentences
$ Mail-> SMTPSecure = "ssl"; // SMTP Security Protocol
$ Mail-> Port = 465; // SMTP server Port number