8516830 发表于 2018-1-11 08:02:26

gitlab 配置邮箱

  摘自: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
  注意:
发邮件的程序取的是gitlab.yml里的值,因为我们这里gitlab 用的是8080端口访问的(ubicorn.rb里定义的),所以这里我们把port也给改成8080(修改gitlab下面的port)  最后我们修改下面的内容:
  cd/home/git/gitlab/config/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,然后我们就注册用户试验一下
  测试结果的邮件样式为:
https://images2015.cnblogs.com/blog/916267/201605/916267-20160511092229312-1691342247.png
页: [1]
查看完整版本: gitlab 配置邮箱