smtp测试出现smtp error

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了smtp测试出现smtp error相关的知识,希望对你有一定的参考价值。

(1)首先,你必须确定你的smtp发送服务器地址是不是完全正确(2)如果确定正确那原因就简单了。在“更改电子邮件账户”对话框,右下角有一个“其他设置”按钮。点一下。打开“internet电子邮件设置”对话框。在“常规”选项卡下面,有个“邮件账户”这里必须填写,你自己的邮件地址。然后“发送服务器”选项卡。选择“我的发送服务器SMTP要求验证”,“使用与接收邮件服务器相同的设置”。这些设置完成后,点确定,再测试一下。(3)这样基本就没问题了。求采纳。 参考技术A 这个错误说明虚拟主机不支持phpMailer默认调用的fsockopen函数,找到class.smtp.php文件,搜索fsockopen,代码如下:  //connecttothesmtpserver  $this->smtp_conn=@fsockopen($host,//thehostoftheserver  $port,//theporttouse  $errno, //errornumberifany  $errstr, //errormessageifany  $tval); //giveupafter?secs方法1:将fsockopen函数替换成pfsockopen函数  首先,在php.ini中去掉下面的两个分号  ;extension=php_sockets.dll  ;extension=php_openssl.dll  然后重启一下 因为pfsockopen的参数与fsockopen基本一致,所以只需要将@fsockopen替换成 @pfsockopen就可以了。方法2:使用stream_socket_client函数  一般fsockopen()被禁,pfsockopen也有可能被禁,所以这里介绍另一个函数 stream_socket_client()。  stream_socket_client的参数与fsockopen有所不同,所以代码要修改为:  代码如下复制代码  $this->smtp_conn=stream_socket_client("tcp://".$host.":".$port,$errno, $errstr, $tval);ok问题到问题求助专区

Gitlab smtp 测试失败

【中文标题】Gitlab smtp 测试失败【英文标题】:Gitlab smtp test failed 【发布时间】:2019-04-19 06:26:41 【问题描述】:

我正在使用 gitlab 社区版(综合安装)。我尝试配置 SMTP 设置,但在测试配置时出现错误。我相信我们的 smtp 地址没有用户名和密码。

 gitlab_rails['smtp_enable'] = true
 gitlab_rails['smtp_address'] = "xx.xxxx.com"
 gitlab_rails['smtp_port'] = 465
 gitlab_rails['smtp_enable_starttls_auto'] = true
 gitlab_rails['smtp_tls'] = false
 gitlab_rails['smtp_openssl_verify_mode'] = 'none'

请告诉我应该如何解决此错误。我无法理解错误在哪里。

 GitLab:       11.3.1 (32cb452)
 GitLab Shell: 8.3.3
 postgresql:   9.6.8
-------------------------------------------------------------------------------------
Loading production environment (Rails 4.2.10)
irb(main):001:0> ActionMailer::Base.delivery_method
=> :smtp
irb(main):002:0> Notify.test_email('xx.xx@xxx.com', 'Hello World', 'This is test')


    Notify#test_email: processed outbound mail in 210.3ms

Sent mail to xx.xx@xx.com (30012.0ms)
Date: Thu, 15 Nov 2018 23:24:13 +0000
From: GitLab <gitlab@xx.com>
Reply-To: GitLab <gitlab@xx.com>
To: xx.xx@xxx.com
Message-ID: <5bee001d73945_d693fc0e59daf4021724@ip-10-xx-x-xx.mail>
Subject: Hello World
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-htm
<html><body><p>This is a test message</p></body></html>

Net::OpenTimeout: execution expired
        from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:539:in `initialize'
        from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:539:in `open'
        from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:539:in `tcp_socket'
        from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:549:in `block in do_start'
        from /opt/gitlab/embedded/lib/ruby/2.4.0/timeout.rb:103:in `timeout'
        from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:548:in `do_start'
        from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:518:in `start'
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/mail-2.7.0/lib/mail/network/deliion'
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/mail-2.7.0/lib/mail/network/deli
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/mail-2.7.0/lib/mail/message.rb:2
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/mail-2.7.0/lib/mail/message.rb:2
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/actionmailer-4.2.10/lib/action_m
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/activesupport-4.2.10/lib/active_strument'
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/activesupport-4.2.10/lib/active_`instrument'
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/activesupport-4.2.10/lib/active_
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/actionmailer-4.2.10/lib/action_m
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/mail-2.7.0/lib/mail/message.rb:2
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/actionmailer-4.2.10/lib/action_m'
        from (irb):2
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/comman
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/comman
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/comman
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/comman
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/comman
        from bin/rails:14:in `require'
        from bin/rails:14:in `<main>'
irb(main):003:0> exit

【问题讨论】:

【参考方案1】:

你和issue 22728有同样的情况,但升级后它似乎消失了。 就您而言,您已经处于最新版本(几乎:检查 11.4 是否有帮助)

Issue 23600 指出了阻止传出 smtp 的云提供商。

还要检查 "Mail not working" section 以确保以下值:

ActionMailer::Base.delivery_method ActionMailer::Base.smtp_settings

【讨论】:

以上是关于smtp测试出现smtp error的主要内容,如果未能解决你的问题,请参考以下文章

用phpmailer发送邮件提示SMTP Error: Could not connect to SMTP host解决办法

Gitlab smtp 测试失败

使用 .net 测试 SMTP

smtp邮件测试

Python 2.7测试是否发送了SMTP邮件

邮件协议(SMTP)性能测试总结(Foxmail邮箱)