An error occurred while sending emails with phpmailer & lt ;? Phprequire_once ('class. phpmailer. php '); & nbsp; // the downloaded file must be placed in the directory where the file is located $ address = $ _ POST ['address']; echo & nbsp; an error occurred while sending emails using phpmailer.
Require_once ('class. phpmailer. php'); // the downloaded file must be in the directory where the file is located.
$ Address = $ _ POST ['address'];
Echo $ address ."
";
$ Mail = new PHPMailer (); // Create a mail sending class
$ Address = $ _ POST ['address'];
$ Mail-> IsSMTP (); // send using SMTP
$ Mail-> Host = "smtp.163.com"; // your enterprise Post Office domain name
$ Mail-> SMTPAuth = true; // enable SMTP verification
$ Mail-> Username = "********** @ 163.com"; // Post Office Username (enter the complete email address)
$ Mail-> Password = "********"; // Post Office Password
$ Mail-> From = "****** @ 163.com"; // email address of the email sender
$ Mail-> FromName = "";
$ Mail-> AddAddress ("$ address", "QQ"); // The recipient address, which can be replaced with any email address to receive the email,
$ Mail-> Subject = "PHPMailer test mail"; // mail title
$ Mail-> Body = "Hello, this is the test mail"; // The mail content
$ Mail-> AltBody = "This is the body in plain text for non-HTML mail clients"; // additional information, which can be omitted
If (! $ Mail-> Send ())
{
Echo "failed to send the email.
";
Echo "error cause:". $ mail-> ErrorInfo;
Exit;
}
Echo "email sent successfully ";
?>
Warning: preg_match () [function. preg-match]: Compilation failed: reference to non-existent subpattern at offset 626 in C: \ Program Files \ Apache Software Foundation \ Apache2.2 \ htdocs \ class. phpmailer. php on line 667
An error occurred while sending the email.
Error cause: You must provide at least one recipient email address.
Share:
------ Solution --------------------
Whether your account 163 is a valid account. Can I try QQ mail?
$ Mail-> AddAddress ($ address); // you can try this operation.