Gitlab CE不发送电子邮件
Posted
技术标签:
【中文标题】Gitlab CE不发送电子邮件【英文标题】:Gitlab CE not sending email 【发布时间】:2017-04-07 09:54:15 【问题描述】:我已经在本地 Ubuntu 服务器上设置了 Gitlab CE,我正在尝试使用 Zoho 向用户发送电子邮件。但是,邮件不会发送。即使使用gitlab-rails console
进行测试:
irb(main):003:0> Notify.test_email('destination_email@address.com', 'Message Subject', 'Message Body').deliver_now
我的 SMTP 配置如下:
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.zoho.com"
gitlab_rails['smtp_port'] = 587 # I've also changed to 465, but in vain
gitlab_rails['smtp_authentication'] = "plain"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_user_name'] = "gitlab@mydomain.com"
gitlab_rails['smtp_password'] = "mypassword"
gitlab_rails['smtp_domain'] = "smtp.zoho.com"
并通过电子邮件配置回复:
gitlab_rails['incoming_email_enabled'] = true
gitlab_rails['incoming_email_address'] = "gitlab-incoming+key@domain.com"
gitlab_rails['incoming_email_email'] = "gitlab@domain.com"
gitlab_rails['incoming_email_password'] = "Password"
gitlab_rails['incoming_email_host'] = "imap.zoho.com"
gitlab_rails['incoming_email_port'] = 993
gitlab_rails['incoming_email_ssl'] = true
gitlab_rails['incoming_email_mailbox_name'] = "inbox"
gitlab_rails['incoming_email_idle_timeout'] = 60
有人可以帮我解决这个问题吗?
更新:这是gitlab_rails console
中的测试输出
Notify#test_email:在 414.5 毫秒内处理出站邮件
发送邮件到 user@domain.com (65666.5ms) 日期:2016 年 11 月 23 日,星期三 12:47:12 +0100 来自:亚搏体育app 回复:GitLab
收件人:user@domain.com
消息 ID:
主题:测试
Mime 版本:1.0
内容类型:文本/html; 字符集=UTF-8 内容传输编码:7bit
测试
Net::ReadTimeout: Net::ReadTimeout 来自 /opt/gitlab/embedded/lib/ruby/2.3.0/net/protocol.rb:158:in
rbuf_fill' from /opt/gitlab/embedded/lib/ruby/2.3.0/net/protocol.rb:136:in
readuntil' 来自 /opt/gitlab/embedded/lib/ruby/2.3.0/net/protocol.rb:146:inreadline' from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:946:in
recv_response' 来自 /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:556:inblock in do_start' from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:956:in
critical' 来自 /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:556:indo_start' from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:521:in
start' 来自 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/mail-2.6.4/lib/mail/network/delivery_methods/smtp.rb:113:indeliver!' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/mail-2.6.4/lib/mail/message.rb:2 149:in
do_delivery' 来自 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/mail-2.6.4/lib/mail/message.rb:2 37:inblock in deliver' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/actionmailer-4.2.7.1/lib/action_ mailer/base.rb:543:in
block in Deliver_mail' 来自 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active _support/notifications.rb:164:inblock in instrument' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active _support/notifications/instrumenter.rb:20:in
instrument' 来自 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active _support/notifications.rb:164:ininstrument' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/actionmailer-4.2.7.1/lib/action_ mailer/base.rb:541:in
deliver_mail' 来自 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/mail-2.6.4/lib/mail/message.rb:2 37:indeliver' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/actionmailer-4.2.7.1/lib/action_ mailer/message_delivery.rb:85:in
deliver_now' 来自 (irb):1 来自 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/comma nds/console.rb:110:instart' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/comma nds/console.rb:9:in
start' 来自/opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/comma nds/commands_tasks.rb:68:inconsole' from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/comma nds/commands_tasks.rb:39:in
run_command! 来自 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/comma nds.rb:17:in<top (required)>' from bin/rails:9:in
require' 从 bin/rails:9:in `'
【问题讨论】:
没有错误?没有?你试过什么? @pancho018 看看我的更新。谢谢。 @sk001 我面临着完全相同的问题。自从我将 gitlab 更新到 9.1.3 后,它就开始失败了。你能找到解决办法吗? @sk001 你找到解决方案了吗?你修好了吗?谢谢 @Farzan 你解决了你的问题吗?如果是,你是怎么做的?真的谢谢 【参考方案1】:我设法用这里接受的答案解决了这个问题:ActionMailer "Net::ReadTimeout" when using Delayed Job with Rackspace "emailsrvr.com"
可能是文档中的一些建议设置 (https://docs.gitlab.com/omnibus/settings/smtp.html) 导致了问题。
这些设置对我有用:
gitlab_rails['smtp_address'] = "secure.emailsrvr.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_domain'] = "domain.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_tls'] = true
gitlab_rails['smtp_user_name'] = "no-reply@domain.com"
gitlab_rails['smtp_password'] = "XXX"
gitlab_rails['gitlab_email_from'] = "no-reply@domain.com"
gitlab_rails['gitlab_support_email'] = "support@domain.com"
gitlab_rails['gitlab_email_reply_to'] = "support@domain.com"
【讨论】:
以上是关于Gitlab CE不发送电子邮件的主要内容,如果未能解决你的问题,请参考以下文章