<?php
header("content-type:text/html;charset=utf-8");
require_once './email.class.php';
$name = "iojdsfajijd";
$mobile = "13344448888";
if (!empty($name) && !empty($mobile)){
$smtpserver = "smtp.exmail.qq.com";
$smtpserverport = 25;
$smtpusermail = "om@xxx.com";
$smtpmailtos = array("xxx@qq.com");
$smtpuser = "om@xxx.com";
$smtppass = "mypassword";
$mailsubject = "来源网页:".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$mailbody = '';
$br="\r\n";
$mailbody .= "姓名:".$name.$br;
$mailbody .= "电话:".$mobile.$br;
$mailtype = "text";
$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);
$smtp->debug = true;
foreach ($smtpmailtos as $smtpmailto){
$sendState=$smtp->sendmail($smtpmailto, $smtpusermail, $mailsubject,$mailbody,$mailtype);
}
// if ( $sendState==1 ){
$list = array('name'=>$name,'tel'=>$mobile);
$json = json_encode($list);
echo $json;
//}
}
CDN用百度云和加速乐都出现了这种问题。我目前是用的百度云
我的邮件发送代码如上,在没用cdn的服务器上是可以正常发送邮件的,用了cdn之后,邮件发送出现如下报错:
Cannot connenct to relay host smtp.exmail.qq.com
Connection timed out (110)
Cannot send email to xxx@qq.com
解决过的办法:
iptables 出端口全部绿灯
php版本:5.6 检查了php.ini 和 allow_url_fopen = On,disable_function 没用 fsock和fsockopen函数,请问是怎么回事呢?求解答,谢谢
慕容3067478
小怪兽爱吃肉
慕码人8056858