Problems occurred when sending emails using phpmailer

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.