dpepbjp126917 2016-01-26 21:07
浏览 226

无法使用PEAR Mail为端口587发送邮件,但对端口25使用是

I cannot seem to get port 587 to send mail. I am capable of sending mail using port 25. I'm using PEAR Mail to send this.

require_once "Mail.php";

/**************************************************
EDIT the following variables for your own use
***************************************************/
$from = "Noreply <noreply@host.com>";
$to = "Abc <abc@host.com>";

$subject = "Hi!"; //type in subject here

$host = "mail.host.com"; // also tried ssl://mail.host.com and tls://mail.host.com
$username = "noreply@host.com"; // Your user / full email address
$password = "password"; // Password to your email address

/**************************************************
***************************************************/

$body = "test message";
$headers = array (
'From' => $from,
'To' => $to,
'Date' => date('Y-m-d H:i:s'),
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password,
'port'=>587));

$mail = $smtp->send($to, $headers, $body);
  • 写回答

1条回答 默认 最新

  • duandanxiu6965 2016-01-27 10:58
    关注

    Enable SMTP TLS / SSL in PEAR::MAIL

    Edit the file - /pear/Net_SMTP/Net/SMTP.php

    Find the line with the following content (approximately line 590):

    function auth($uid, $pwd, $method = '', $tls = false, $authz = '')

    Replace this with:

    function auth($uid, $pwd, $method = '', $tls = true, $authz = '')

    So your changing '$tls' from 'false' to 'true' Save the file And try with port 587

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度