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.
Reply to discussion (solution)
$ Mail-> AddAddress ($ address, "QQ"); // What about this?
$ Mail-> AddAddress ($ address, "QQ"); // What about this?
No. Have you tried it?
Echo $ address; // What is the value?
Output your $ address. it may not be the correct email address.
Output your $ address. it may not be the correct email address.
I have output, and a new problem occurs after I change it.
Cocould not instantiate mail function. failed to send the email.
Cause of error: cocould not instantiate mail function
Echo $ address; // What is the value?
Check whether my mailbox is correct. the output result is my mailbox.
$ Mail-> SMTPDebug = 1; // add this sentence to check whether the cause can be found.
$ Mail-> SMTPDebug = 1; // add this sentence to check whether the cause can be found.
No, the result is also the cocould not instantiate mail function. The mail failed to be sent.
Cause of error: cocould not instantiate mail function.
Whether your account 163 is a valid account. Can I try QQ mail?
$ Mail-> AddAddress ($ address); // you can try this operation.
Whether your account 163 is a valid account. Can I try QQ mail?
$ Mail-> AddAddress ($ address); // you can try this operation.
No. I don't think it's about Encoding. it's about php. ini configuration.
Whether your account 163 is a valid account. Can I try QQ mail?
$ Mail-> AddAddress ($ address); // you can try this operation.
I found a few words on some websites, but I couldn't open the specific content.
Email Error: cocould not instantiate mail function this is actually caused by improper settings. in the background email settings, we need to use this type of: name if not set like this...
I also encountered the same problem. debugging in the win environment is completely normal. This occurs when I port it to centos5.9.
Invalid address: failed to send 12336@qq.com mail, error message: You must provide at least one recipient email address.