首页 > 其他 > 网站日记>正文

帝国cms中发送邮件的调试

提示: 阅读权限:公开  
在e目录下,临时添加一个php文件,比如名字为linshi.php ,内容为:
<?php
require('class/connect.php');
require('class/db_sql.php');
$link=db_connect();
$empire=new mysqlquery();
echo "send start <br />";
include('class/SendEmail.inc.php');
$email="zzjwlby@126.com";//邮件接收者的E-mail
$moshi=2;// 用后台参数    2    用自定义参数


$title='测888试20220416';
$content='您好,希望疫情早点结束!请做好个人防护。';
if($moshi==1){
    $sm=EcmsToSendMail($email, $title,$content);//邮件接收者的E-mail, 邮件标题, 邮件正文
}else{
    	//$pr=$empire->fetch1("select sendmailtype,smtphost,fromemail,loginemail,emailusername,emailpassword,smtpport,emailname from {$dbtbpre}enewspublic limit 1");
    	/*
    	
    [sendmailtype] => 1
    [smtphost] => smtp.163.com
    [fromemail] => sxoxgs@163.com   XGJQGRZERLIRLXKD
    [loginemail] => 1
    [emailusername] => ***
    [emailpassword] => ***
    [smtpport] => 465
    [emailname] => 在线预约
    	
    	*/
    $pr['sendmailtype']=1;	
    $pr['smtphost']='smtp.163.com';
    $pr['fromemail']='yf90113325@163.com';
    $pr['loginemail']=1;
    $pr['emailusername']='yf90113325';
    $pr['emailpassword']='********';
    $pr['smtpport']=465;
    $pr['emailname']='在线预约';
    
    
    
    	
	//发送初使化
	$mailer=FirstSendMail($pr,$title,$content);
	if(is_array($email))
	{
		$count=count($email);
		for($i=0;$i<$count;$i++)
		{
			if($email[$i])
			{
				$mailer->AddAddress($email[$i]);
			}
		}
	}
	else
	{
		$mailer->AddAddress($email);
	}
	if(!$mailer->Send())
	{
		echo  '发送失败';
	}else{
	    echo('发送成功');
	}
}





echo $mail_test." send over <br />";

db_close();

$empire=null;

?>
然后,打开smtp的错误开关,修改文件e/class/SendEmail.inc.php
public $SMTPDebug     = '10';//false;


获取邮箱参数的代码:
 	$pr=$empire->fetch1("select sendmailtype,smtphost,fromemail,loginemail,emailusername,emailpassword,smtpport,emailname from {$dbtbpre}enewspublic limit 1");
/*
[smtphost] => smtp.163.com
    [fromemail] => ***@163.com
    [loginemail] => 1
    [emailusername] => ****
    [emailpassword] => ***
    [smtpport] => 465




*/


帝国后台的设置:



访问,linshi.php 就可以看到详细的错误信息。
 
/*
 ERROR: Failed to connect to server: Connection timed out (110)

*/

常见问题:

1. 服务器的安全组要不要放行465端口
2. SMTP -> FROM SERVER:553 Local user only,163 smtp4,HNxpCgCXRbYa8llirSmnBQ--.10006S3 1650061850
3. MTP -> ERROR: MAIL not accepted from server: 550 Invalid User



 

上一篇:帝国cms二开之会员组购买不能有小数的问题

下一篇:php代码判断是不是微信内部浏览器

tags:

返回首页

相关

热门

站内直通车

[!--temp.bottomnav--]
返回顶部