GitLab email setup: sending via another mail serve

2019-01-21 09:19发布

By default gitlab has the next configuration in gitlab.yml :

email:
  from: notify@gitlabhq.com
  host: gitlabhq.com

but, I need to specify other variables (host, port, user, password, etc) to use another mail server.

How I do that?

7条回答
祖国的老花朵
2楼-- · 2019-01-21 10:08

This is my entries at the end in /config/environment/production.rb and that is working for me.


Comment out sendmail options and use external SMTP relays


  # #config.action_mailer.delivery_method = :sendmail ## Comment out this

  # 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

  # # SMTP Settings

  config.action_mailer.delivery_method = :smtp

  config.action_mailer.smtp_settings = {

      :address => '10.146.10.90', ## My SMTP Relay/Gateway

      :port => 25, ## SMTP Port

      :domain => 'gitlab.example.com', ## My Domain

      :authentication => :plain, ## Let it be plain as it is inside my LAN

      ##:user_name => 'gitlab@yourserver.com', ## This is not required as long as 

      ##:password => 'yourPassword', ## SMTP Gateway allows anonymous relay

      ##:enable_starttls_auto => true ## In LAN

      ##:user_name => '',

      ##:password => '',

      :enable_starttls_auto => true
  }
end

查看更多
登录 后发表回答