简体   繁体   English

无法连接到smtp.gmail.com:587

[英]Failed to connect to smtp.gmail.com:587

I am using pear mail library using this error in Yii framework 我正在使用Yii框架中的此错误的梨邮件库

Failed to connect to smtp.gmail.com:587 [SMTP: HELO was not accepted (code: -1, response: )] Error code:10001 无法连接到smtp.gmail.com:587 [SMTP:不接受HELO(代码:-1,响应:)]错误代码:10001

Config file contained 包含的配置文件

'zebrostMailer' => array(
            'class' => 'application.extensions.zebrostMailer.CZebrostMailer',
            'host' => 'smtp.gmail.com',
            'port' => 587,
            'helo' => '',
            'auth' => true,
            'username' => 'user@gmail.com',
            'password' => '*******',
            'from' => 'TestUser',
            'timeout' => '5',
            'SMTPAuth' => true,
            'SMTPSecure' => 'tls',

        ),

phpmailer.php phpmailer.php

<?php

include('Mail.php'); 包括( 'Mail.php'); include('Mail/mime.php'); 包括( '邮件/ mime.php');

class CZebrostMailer extends CApplicationComponent { CZebrostMailer类扩展了CApplicationComponent {

public $host;
public $port;
public $helo;
public $auth;
public $username;
public $password;
public $from;
public $timeout;
public $SMTPAuth;
public $SMTPSecure;
public $Mailer;

public function SendEmail($to, $subject, $body, $htmlImages = null) {
    $mime = new Mail_mime();
    $headers = array(
        'From' => $this->from,
        'To' => $to,
        'Subject' => $subject
    );
    @$mime->setHTMLBody($body);
    if ($htmlImages) {
        foreach ($htmlImages as $htmlImage) {
            $mime->addHTMLImage(
                    $htmlImage, Yii::app()->zebrostGenFuncs->getMimeType($htmlImage)
            );
        }
    }
    $body = @$mime->get();
    $headers = @$mime->headers($headers);
    $smtp = @Mail::factory('smtp', array(
                'host' => $this->host,
                'port' => $this->port,
                'localhost' => $this->helo,
                'auth' => $this->auth,
                'username' => $this->username,
                'password' => $this->password,
                'timeout' => $this->timeout,
                'SMTPSecure' => $this->SMTPSecure,
                'SMTPAuth' => $this->SMTPAuth,

    ));
    if (@PEAR::isError($smtp)) {
        throw new CException(@$smtp->getMessage() . ' Error code:' . @$smtp->getCode());
    }
    $mail = @$smtp->send($to, $headers, $body);
    if (@PEAR::isError($mail)) {
        throw new CException(@$mail->getMessage() . ' Error code:' . @$mail->getCode());
    }
}

} }

I am badly stuck please help me out 我被严重卡住,请帮帮我

I got solution of my problem on the same day when i post my question. 我在发布问题的当天就得到了问题的解决方案。 There is only problem is I am sending blank 'helo' to smtp.gmail.com That's why connection is not established. 唯一的问题是我向smtp.gmail.com发送了空白的“ helo”,这就是未建立连接的原因。

暂无
暂无

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

相关问题 smtp.gmail.com,端口:587 失败 - smtp.gmail.com, port: 587 fails 无法连接到 SMTP 主机:smtp.gmail.com,端口:Windows Server 2016 上的 587 - Could not connect to SMTP host: smtp.gmail.com, port: 587 on windows server 2016 无法连接到SMTP主机:smtp.gmail.com,port:587; 嵌套异常是:java.net.ConnectException:连接超时:连接 - Could not connect to SMTP host: smtp.gmail.com, port: 587; nested exception is: java.net.ConnectException: Connection timed out: connect com.sun.mail.util.MailConnectException:无法连接到主机,端口:smtp.gmail.com,587; 超时-1 - com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout -1 Python:发送电子邮件时,始终在子句中阻止:smtpserver = smtplib.SMTP(“smtp.gmail.com”,587) - Python: when sending email, always blocked in the clause: smtpserver = smtplib.SMTP(“smtp.gmail.com”,587) 无法连接到SMTP主机:smtp.gmail.com,端口:465 - could not connect to smtp host:smtp.gmail.com, port:465 我无法从 OVH 托管 Kubernetes 集群访问 smtp.gmail.com 587 - I Can not access smtp.gmail.com 587 from OVH Managed Kubernetes Cluster 从Spring Boot拒绝连接到主机:smtp.gmail.com端口:587 - Connection refused to host: smtp.gmail.com port: 587 from Spring Boot Mutt - 无法连接到smtp.gmail.com(系统调用中断) - Mutt - Could not connect to smtp.gmail.com (Interrupted system call) Jenkins:“ javax.mail.MessagingException:无法连接到SMTP主机:smtp.gmail.com,端口:465;” - Jenkins: “javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM