摘自:http://www.tuicool.com/articles/ruyERz
这里我用的是263企业邮箱
这里我们用smtp发送邮件,要是系统自带有sendmail,我们就给他卸掉,yum remove sendmail
yum -y install postfix
/etc/init.c/postfix start
然后我们测试一下服务器看能不能发送邮件
echo "Test mail from postfix" | mail -s "Test Postfix" smail_bao@163.com
然后我们这里我们登录163邮箱看一下发件人是谁,
我们修改一下,gitlab.yml 文件的的email_from 就为这个地址
email_from: root@git.localdomain
email_display_name: GitLab
email_reply_to: smail_bao@163.com
注意:
最后我们修改下面的内容:
cd /home/git/gitlab/config/environments
[root@git environments]# vim production.rb
config.action_mailer.delivery_method = :smtp
# 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.smtp_settings = {
:address => "smtp.263.net",
:port => 25,
:domain => '263.net',
:user_name => 'baoxy@yizhenmoney.com',
:password => '12345678',
:authentication => :plain,
:enable_starttls_auto => true
}
重启一下gitlab,然后我们就注册用户试验一下
测试结果的邮件样式为: