从phpmailer发送邮件正在工作,但cakephp邮件不能与saim cradienial一起使用

问题描述 投票:1回答:1

我正在使用phpmailer发送邮件工作正常,但在蛋糕php它不工作。请看一下配置

对于PhpMailer:

$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';
$mail->SMTPSecure = false;
$mail->SMTPAuth = false; 
$mail->Host = "localhost";
$mail->Port = 25;
$mail->IsHTML(true);
$mail->Username = "[email protected]";
$mail->Password = "password";

对于CakePhp:

public $smtp = array(
    'transport' => 'Smtp',
    'from' => array('[email protected]' => 'My domain'),
    'host' => 'localhost',
    'port' => 25,
    'timeout' => 30,
    'username' => '[email protected]',
    'password' => 'password',
    //'client' => null,
    //'log' => false,
);

我发现以下事情是为Phpmailer做的工作。

$mail->SMTPSecure = false;
$mail->SMTPAuth = false;

请任何人协助我在cakephp中使用SMTPSecure和SMTPAuth的替代方法

php cakephp cakephp-2.0 phpmailer
1个回答
2
投票

尝试将上下文中的SSL参数作为数组传递。

 public $SendMail = array(
  'host' => 'smtp.host.com',
  'port' => 587, 
  'username' => '[email protected]',
  'password' => 'password',       
  'transport' => 'Smtp',
  'SMTPSecure' => 'tls',
  'tls' => true,
  'context'=>array('ssl' => array(
      'verify_peer' => false,
      'verify_peer_name' => false,
      'allow_self_signed' => true
    )), 
 );
© www.soinside.com 2019 - 2024. All rights reserved.