2 更改配置以發(fā)送郵件
重要!此時(shí)還不能發(fā)送郵件。需要更改幾個(gè)配置:
1)config/environments/production.rb
vi /opt/gitlab-7.1.1-0/apps/gitlab/htdocs/config/environments/production.rb
........
# config.action_mailer.delivery_method = :sendmail
# Defaults to:
# # config.action_mailer.sendmail_settings = {
# # location: '/usr/sbin/sendmail',
# # arguments: '-i -t'
# # }
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.qq.com",
:port => "25",
:domain => "smtp.qq.com",
:authentication => :plain,
:user_name => "3501xxxxx@qq.com",
:password => "********",
:enable_starttls_auto => true
}
........
2)config/environments/production.rb
# cd /opt/gitlab-7.1.1-0/apps/gitlab/htdocs/config/initializers/
# cp smtp_settings.rb.sample smtp_settings.rb
# vi smtp_settings.rb
To enable smtp email delivery for your GitLab instance do next:
1. Rename this file to smtp_settings.rb
2. Edit settings inside this file
3. Restart GitLab instance
#
if Rails.env.production?
Gitlab::Application.config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: "smtp.qq.com",
port: 25,
user_name: "3501xxxxx@qq.com",
password: "********",
domain: "qq.com",
authentication: :login,
enable_starttls_auto: true
}
end
3)config/gitlab.yml
找到下面的內(nèi)容,改成你的email地址:
# # # # # # # # # # # # # # # #
GitLab application config file
# # # # # # # # # # # # # # # #
#
How to use:
1. copy file as gitlab.yml
2. Replace gitlab -> host with your domain
3. Replace gitlab -> email_from
production: &base
#
# 1. GitLab app settings
# ==========================
## GitLab settings
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: 192.168.82.181
port: 80
https: false
# Uncommment this line below if your ssh host is different from HTTP/HTTPS one
# (you'd obviously need to replace ssh.host_example.com with your own host).
# Otherwise, ssh host will be set to the `host:` value above
# ssh_host: ssh.host_example.com
# WARNING: See config/application.rb under "Relative url support" for the list of
# other files that need to be changed for relative url support
# relative_url_root: /gitlab
# Uncomment and customize if you can't use the default user to run GitLab (default: 'git')
# user: git
## Email settings
# Email address used in the "From" field in mails sent by GitLab
email_from: 3501xxxxx@qq.com
support_email: 3501xxxxx@qq.com
# Email server smtp settings are in [a separate file](initializers/smtp_settings.rb.sample).
........ 3 啟動(dòng)服務(wù)并訪問(wèn)
/opt/gitlab-7.1.1-0/ctlscript.sh restart
此時(shí)創(chuàng)建用戶,就會(huì)發(fā)送郵件了。
別忘記 qq郵箱中打開(kāi)下面的服務(wù):
上面的部分是我參照的東西,我是用的是163郵箱,也差不多。不知道為什么確認(rèn)郵件一直收不到。求高手指點(diǎn),謝謝。
在百度上也有提問(wèn),如果大家想要獎(jiǎng)勵(lì)有100財(cái)富,還可以追加到300財(cái)富






