我正在尝试使用stmp配置发送邮件,但它总是显示一个微不足道的编码无效错误。我猜测我的验证方法在选择prce8
时有一个错误(我使用的是php5,因此它选择了最佳选择pcre8)。我已经检查了answer,但仍然无效!
<?php
require_once('class.mail.php');
$to=isset($_POST['verify'])?$_POST['verify']:false;
$subject="TSHED Email verification";
$message='<html><p> my message </p></html>';
$mail = new PHPMailer();
$mail->isSMTP(); // telling the class to use SMTP
// SMTP Configuration
$mail->SMTPsecure='ssl';
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "smtp.gmail.com "; // SMTP server
$mail->Username = "myEmail";
$mail->Password = "mypassword";
$mail->Port = 465; // optional if you don't want to use the default
$mail->From = "<FromanEmail>";
$mail->FromName = "Name";
$mail->Subject = $subject;
//$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->isHTML($message);
$mail->Body=$message;
$mail->msgHTML($message);
// Add as many as you want
$mail->AddAddress($to,'USER');
if(!$mail->Send())
{ //echo"endterer";
$response = "Message error!".$mail->ErrorInfo;
echo $response;
echo $to;
}
else {
$response = "Message sent!";
echo $response;
}
?>
请帮忙吗? 我的pcre8:
case 'pcre8':
return (boolean)preg_match(
'/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
'((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' .
'(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' .
'([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' .
'(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' .
'(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' .
'|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' .
'|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
'|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
$address
);
有效电子邮件的例子:ouedson0128@yahoo.fr
错误:地址无效:(punyEncode)
答案 0 :(得分:0)
似乎这是phpMailer中的一个错误。尝试其他版本