PHP开发实例大全(提高卷) 中文完整pdf扫描版[244MB]
创建设文件testport.php(来自老外的论坛)
<?php
if(!function_exists('fsockopen')) {
echo '<span style="color:red">fsockopen is not enabled</span>';
return;
}
$tests = array(25 => 'smtp.sendgrid.com',2525 => 'smtp.sendgrid.com',587 => 'smtp.sendgrid.com',465 => 'ssl://smtp.sendgrid.com');
foreach($tests as $port => $server){
$fp = @fsockopen($server,$port,$errno,$errstr,5);
if($fp){
echo '<br/><span style="color:green" >Port '.$port.' opened on your server</span>';
fclose($fp);
}else{
echo '<br/><span style="color:red" >Port '.$port.' NOT opened on your server</span>';
echo " errornum: ".$errno.' : '.$errstr;
}
}
?>
fsockopen is not enabled 如果出现这个错误(我只碰到这个,端口都没问题)
百度上有
关键三步
修改php.ini文件
disable_functions 这个变量中去掉 fsockopen 在最后面
allow_url_fopen = on
extension=php_openssl.dll 去掉前面分号(gmail 用的端口协议是ssl的,所以服务器得有openssl服务,若没有度娘之)
附带zencart zen_email函数未例
$html_msg=array();
$html_msg['EMAIL_MTCN'] = 'mtcn';
$html_msg['EMAIL_ELSE'] = 'it is test';
$name='first';
$email_address='xxx@gmail.com';
$subject='Test Email ?';
$email_text='there is test text'."\n\n";
$store_name='My Shop';
$from_email_address='xxx@gmail.com';
zen_mail($name, $email_address, $subject, $email_text, $store_name, $from_email_address, $html_msg, 'western_union');
转载请注明:谷谷点程序 » zencart 邮箱设置错误的解决方法