if Rails.env.production?
Gitlab::Application.config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
#smtp服务器地址
address: “mail.company.com”,
#smtp服务端口
port: 25,
#内部邮件系统配置的邮箱
user_name: “gitlab@company.com”,
#邮箱的密码
password: “password”,
#邮件服务器的域名
domain: “company.com”,
authentication: :login,
enable_starttls_auto: false,
openssl_verify_mode: ‘none’ # See ActionMailer documentation for other possible options
}
end
3. 修改gitlab配置文件
1 2
cd /home/git/gitlab sudo -u git -H vim config/gitlab.yml
## Email settings
# Email address used in the “From” field in mails sent by GitLab
#刚才配置的公司邮箱
email_from: gitlab@company.com
#发信人的名称,接收邮件时,显示在”发信人”里
email_display_name: GitLab CE