Problems when sending e-mails with Phpmailer

Source: Internet
Author: User
There's a problem with Phpmailer e-mail
Require_once (' class.phpmailer.php '); The downloaded file must be placed in the directory where the file is located
$address =$_post[' address ';
echo $address. "
";
$mail = new Phpmailer (); Set up a mail sending class
$address = $_post[' address '];
$mail->issmtp (); Send using SMTP mode
$mail->host = "smtp.163.com"; Your enterprise Post office domain name
$mail->smtpauth = true; Enable the SMTP authentication feature
$mail->username = "[email protected]"; Post Office User name (please fill in the full email address)
$mail->password = "********"; Post Office password
$mail->from = "[email protected]"; Email Sender Email Address
$mail->fromname = "";
$mail->addaddress ("$address", "QQ"), or/or the recipient's address, can be replaced by any email message you want to receive,
$mail->subject = "phpmailer test mail"; Message header
$mail->body = "Hello, this is Test mail"; Message content
$mail->altbody = "The body in plain text for non-html mail clients"; Additional information, you can omit

if (! $mail->send ())
{
echo "message failed to send.

";
echo "Error Reason:". $mail->errorinfo;
Exit
}

echo "Mail sent successfully";
?>

Warning:preg_match () [Function.preg-match]: compilation failed:reference to non-existent Subpattern @ offset 626 in C: \ Program Files\apache software foundation\apache2.2\htdocs\class.phpmailer.php on line 667
Message delivery failed.
Error reason: Must provide at least one recipient email address.


Share to:


------Solution--------------------
Whether your 163 account is a valid account. Try QQ mailbox can send?
$mail->addaddress ($address); Try this.
  • 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.