简体   繁体   English

讯息:fsockopen():无法连接至ssl://smtp.googlemail.com:465(权限被拒绝)

[英]Message: fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Permission denied)

Email Sending failed from VPS. 从VPS发送电子邮件失败。 It works fine from my localhost but not working in live server. 它可以从我的本地主机正常工作,但不能在实时服务器上工作。 my code is given below. 我的代码如下。

   $config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.googlemail.com',
        'smtp_port' => 465,
        'smtp_user' => 'my gmail email',
        'smtp_pass' => 'email password',
        'mailtype' => 'html',
        'charset' => 'iso-8859-1',
        'wordwrap' => TRUE
    );

    $this->load->library('email', $config);
    $this->email->set_newline("\r\n");

    $this->email->from('from-email', 'name');
    $this->email->to('to-email');
    $this->email->subject('Hello Test');
    $this->email->message('Hello Message');
    if ($this->email->send()) {
        echo 'send';
    }else {
        show_error($this->email->print_debugger());
    }

It works fine in localhost . 它在localhost中可以正常工作。 In my VPS server, it shows error. 在我的VPS服务器中,它显示错误。

A PHP Error was encountered
Severity: Warning

Message: fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Permission denied)

Filename: libraries/Email.php

Line Number: 1990

Backtrace:

File: /var/www/html/company/application/controllers/Welcome.php
Line: 46
Function: send

File: /var/www/html/company/index.php
Line: 315
Function: require_once

来自浏览器的错误屏幕截图

I also changed my smtp_port from 465 to 587 and 25 . 我也将smtp_port465更改为58725 It remains the same error. 它仍然是相同的错误。

How do I solve this? 我该如何解决?

Can anyone tell me, how do I check 465 port is open or not in the server? 谁能告诉我,如何检查服务器中的465端口是否打开? My VPS server os is: centos 我的VPS服务器操作系统是: centos

Thanks for your time. 谢谢你的时间。

I try this, it's work for me. 我尝试这个,对我来说很有效。 I hope it's work for you too 我希望它也对你有用

$config['protocol'] = 'smtp';
$config['smtp_crypto'] = 'tls';
$config['smtp_host'] = 'smtp.gmail.com';    
$config['smtp_port'] = '587';

My suggestion is you check on the ports, make sure your server firewall is permitting smtp . 我的建议是检查端口,确保服务器防火墙允许smtp You might have to check on 您可能需要检查

  • port 25 端口25

.

暂无
暂无

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

相关问题 Codeigniter电子邮件无法在服务器fsockopen()中工作:无法连接至ssl://smtp.googlemail.com:465(连接被拒绝) - Codeigniter Email did not Working in Server fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Connection refused) 出现错误fsockopen():使用codeigniter电子邮件类发送电子邮件时,无法连接到smtp.googlemail.com:465(连接超时) - getting error fsockopen(): unable to connect to smtp.googlemail.com:465 (Connection timed out) while sending email using codeigniter email class Codeigniter无法连接到ssl://smtp.googlemail.com错误 - Codeigniter unable to connect to ssl://smtp.googlemail.com error 实施电子邮件CodeIgniter库时无法连接到ssl://smtp.googlemail.com:25 - Unable to connect to ssl://smtp.googlemail.com:25 while implementing email CodeIgniter lib 消息:fsockopen():无法连接到ssl://smtp.gmail.com:465(连接超时) - Message: fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection timed out) 如何解决错误:消息:fsockopen():无法连接到 ssl://smtp.gmail.com:465(连接被拒绝) - How to resolve the error: Message: fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused) 在Codeigniter中无法发送电子邮件-fsockopen():无法连接到ssl://smtp.gmail.com:465(连接被拒绝) - in Codeigniter Unable to send email - fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused) [SMTP:无法连接套接字:fsockopen():无法连接至ssl://smtp.gmail.com:465(未知错误)(代码:-1,响应:)] - [SMTP: Failed to connect socket: fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Unknown error) (code: -1, response: )] 消息:mail()[function.mail]:无法连接到“ssl://googlemail.com”端口465的邮件服务器 - Message: mail() [function.mail]: Failed to connect to mailserver at “ssl://googlemail.com” port 465 Connection could not be established with host smtp.gmail.com:stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 - Connection could not be established with host smtp.gmail.com :stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM