[请益] 有关网页phpmail模组错误

楼主: lusaka (gary.lusifa)   2017-04-03 18:06:35
各位先进你好
目前我在网页上发先一个问题,就是我们网页上有一个网页寄送e-mail的模组,这个模组
是用phpmailer进行发信
这个模组会有选择我们两间分店,并将相关资料发送mail,但是现在发生一个问题
是选择其中一个分店会出现smtp error The Following recipients failed这个问题
我的web server是用apache + my sql网页连络人资料是再数据库中的联络人资料表,
寄送的方式是网页会利用sendmail寄信。想请问各位先进需要怎么trouble shooting
,因为这个功能在选择其中一间有问题,另外一间却是可以的。
请问各位需要从哪边开始抓问题点。
<?php
//设定
require_once('global.php');
if ($_POST['Mode'] == "Post_Send"){
setcookie("loca",$_POST['loca'], time()+2);
setcookie("Name",$_POST['Name'], time()+2);
setcookie("EMail",$_POST['EMail'], time()+2);
setcookie("Tel",$_POST['Tel'], time()+2);
setcookie("Subject",$_POST['Subject'], time()+2);
setcookie("Content",$_POST['Content'], time()+2);
if (strtolower($_SESSION['AuthCode']) != strtolower($_POST['PostAuthCode'])
|| $_POST['PostAuthCode'] == ""){
ok_msg("Sorry!Img Code error!!","reservation.php");
exit;
}
//写入各资料名称
$filed_temp="N_YN";$field_caption[]=$filed_temp;$field_data[]=0;
$filed_temp="N_loca";$field_caption[]=$filed_temp;$field_data[]=safesql($_POST['loca']);
$filed_temp="N_Name";$field_caption[]=$filed_temp;$field_data[]=safesql($_POST['Name']);
$filed_temp="N_EMail";$field_caption[]=$filed_temp;$field_data[]=safesql($_POST['EMail']);
$filed_temp="N_Tel";$field_caption[]=$filed_temp;$field_data[]=safesql($_POST['Tel']);
$filed_temp="N_Time";$field_caption[]=$filed_temp;$field_data[]=safesql($_POST['Time']);
$filed_temp="N_S1";$field_caption[]=$filed_temp;$field_data[]=safesql($_POST['S1']);
$filed_temp="N_S2";$field_caption[]=$filed_temp;$field_data[]=safesql($_POST['S2'].$_POST['S3']);
$filed_temp="N_Content";$field_caption[]=$filed_temp;$field_data[]=safesql($_POST['Content']);
$filed_temp="N_IP";$field_caption[]=$filed_temp;$field_data[]=GetIP();
$filed_temp="N_ST";$field_caption[]=$filed_temp;$field_data[]=date("Y-m-d
H:i:s");
//阵列处理资料
foreach ($field_caption as $key => $value){$field_caption[$key] =
"`".$value."`";}
foreach ($field_data as $key => $value){$field_data[$key] =
"'".$value."'";$field_edit[$key]=$field_caption[$key]."=".$field_data[$key];}
//写入数据库
$db->query("insert into ".$cfg['TablePrefix']."reservation".$cfg['Lang']."
set ".implode(",",$field_edit)."");
//加载寄信class
require($includespath."class/class.phpmailer.php");
$mail = new phpmailer();
$mail->Mailer = $cfg['phpMailerMethod'];
$mail->Host = $cfg['phpMailerSmtpHost'];
$mail->SMTPAuth = $cfg['phpMailerSMTPAuth'];
$mail->Username = $cfg['phpMailerUsername'];
$mail->Password = $cfg['phpMailerPassword'];
$mail->From = $System['SiteSendMail'.$cfg['Lang']];
$mail->FromName = $System['SiteName'.$cfg['Lang']];
$MailTemp=explode(";",$System['SiteMail'.$cfg['Lang']]);
$eat_place_tmp=$_POST['loca'];
if(preg_match("/高雄店/i",$eat_place_tmp)){
$eat_place=1;
}
else{
$eat_place=2;
}
/*****判断收信者是谁*******
如果判断路径为1,则有#字号的信箱会被切掉#号后寄出,
如果判断为路径2,则不切信箱,有#字号的信箱不会收到*/
if($MailTemp[0]) {
for($i=0;$i<count($MailTemp);$i++){
$tmp_l=strlen($MailTemp[$i])-1;
$tmp=strpos($MailTemp[$i],'#');
if($tmp!=false){
if($eat_place==1){
$mailaddress=substr($MailTemp[$i],0,$tmp_l);
$mail->AddAddress($mailaddress);
}
}
else {
if($eat_place==2){
$mail->AddAddress($MailTemp[$i]);
}
}
}
}
else{
$mail->AddAddress($System['SiteMail'.$cfg['Lang']]);
}
作者: kenwufederer (Nash)   2017-04-03 18:14:00
贴程式码干嘛?不会贴error log吗
作者: SeanBoog (施吉祥先生)   2017-04-04 15:09:00
echo一下收件者呀! error都告诉你收件者无法解析了
作者: dou0228 (7777)   2017-04-05 17:22:00
不嘘不行
楼主: lusaka (gary.lusifa)   2017-04-05 17:58:00
不好意思 已经处理了

Links booklink

Contact Us: admin [ a t ] ucptt.com