Gitlab SMTP发送邮件报错:
Net::OpenTimeout: execution expired
查看Gitlab发送邮件日志:
# tail -f log/sidekiq.log
原因:阿里云服务器默认是屏蔽25端口,采用SSL 465端口发送即可
SMTP远程服务器端口测试:
# telnet smtp.exmail.qq.com 25 //不通
Trying 163.177.72.143...
^C
# telnet smtp.exmail.qq.com 465 //通
Trying 163.177.72.143...
Connected to smtp.exmail.qq.com.
Escape character is '^]'.
^C
Connection closed by foreign host.
#
# sudo -u git -H vim config/initializers/smtp_settings.rb
# sudo -u git service gitlab restart
if Rails.env.production?
Rails.application.config.action_mailer.delivery_method = :smtp
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: "smtp.exmail.qq.com",
port: 465,
ssl: true,
user_name: "example@example.com",
password: "123456",
domain: "mail.example.com",
authentication: :login,
enable_starttls_auto: true,
openssl_verify_mode: 'none'
# openssl_verify_mode: 'peer' # See ActionMailer documentation for other possible options
}
end