web-dev-qa-db-ja.com

GitLabメールのセットアップ:別のメールサーバー経由で送信する

デフォルトでは、gitlabの次の設定はgitlab.yml

email:
  from: [email protected]
  Host: gitlabhq.com

ただし、別のメールサーバーを使用するには、他の変数(ホスト、ポート、ユーザー、パスワードなど)を指定する必要があります。

どうやって?

32
el_quick

これも私を混乱させました。ただし、メール設定を変更するには、config/environments/production.rbで編集します。通常のRails app。

10
Joshua

現在、Gitlab 5.2以降ではまったく異なります。

これは「/home/git/gitlab/config/initializers/smtp_settings.rb.sample」にあり、その中の指示に従うだけです。

40
Girish KG

:この方法は、Gitlabの古いバージョンで役立ちました。 回答を参照 新しいバージョンのGirishの。


Config/environments/production.rbの最後に、次のようなものを追加できます。

  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
      :address => 'yourserver.com',
      :port => 25,
      :domain => 'gitlab.yourserver.com',
      :authentication => :plain,
      :user_name => '[email protected]',
      :password => 'yourPassword',
      :enable_starttls_auto => true
  }

可能な構成の詳細については、ActionMailerのドキュメントを参照してください。 http://api.rubyonrails.org/classes/ActionMailer/Base.html

:Gitlabの更新後にファイルを再度編集する必要がある場合があります

30
Adrian

Gitlab> 7オムニバスの場合、/etc/gitlab/gitlab.rb以下のように実行し、Sudo gitlab-ctl reconfigure

gitlab_Rails['smtp_enable'] = true
gitlab_Rails['smtp_address'] = "smtp.server"
gitlab_Rails['smtp_port'] = 465
gitlab_Rails['smtp_user_name'] = "smtp user"
gitlab_Rails['smtp_password'] = "smtp password"
gitlab_Rails['smtp_domain'] = "example.com"
gitlab_Rails['smtp_authentication'] = "login"
gitlab_Rails['smtp_enable_starttls_auto'] = true
gitlab_Rails['smtp_openssl_verify_mode'] = 'none'

ソース: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/smtp.md

6
topher

email:Host:gitlab.yml構成は、実際にはメールサーバー/ SMTPホスト用ではありません。電子メールでGitlabホストへのリンクを作成するために使用されます。 gitlabサーバーを「gitlab.local」と呼び(そしてDNSエントリがあります)、設定はHost: gitlab.localと言います。

このように、ユーザーがGitlabから電子メールを受信すると、デフォルトでhttp://localhost/にリンクする代わりに、リンクが機能します。

いくつかの冗長構成があります。 Gitlab内でgit clone URLを正しく表示するには、web:Host:git_Host:host:を同じホスト名で構成する必要もあります。

web:
  Host: gitlab.local
  port: 80
  https: false

email:
   Host: gitlab.local
   protocol: http

git_Host:
   Host: gitlab.local

HTTPSを使用している場合は、web:https:web:port:、およびemail:protocol:を変更します。

5
Jimothy

これは/config/environment/production.rbの最後にある私のエントリであり、それは私のために働いています。


Sendmailオプションをコメント化し、外部SMTPリレーを使用する


  # #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 => '[email protected]', ## 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

3
Girish KG

明らかに、これらの設定の場所は、この質問が最初に尋ねられてから(数回)変更されました。現在2018-11-02現在:

設定はgitlab.rb公式ドキュメントに従って:

enter image description here

https://docs.gitlab.com/omnibus/settings/smtp.html

0