繁体   English   中英

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

[英]Cannot send mail using PEAR Mail for port 587 but yes for port 25

我似乎无法获得port 587发送邮件。 我能够使用port 25发送邮件。 我正在使用PEAR Mail发送此邮件。

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);

在PEAR :: MAIL中启用SMTP TLS / SSL

编辑文件-/pear/Net_SMTP/Net/SMTP.php

查找具有以下内容的行(大约590行):

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

替换为:

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

因此,您将'$ tls'从'false'更改为'true'保存文件并尝试使用端口587

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM