質問

デフォルトでgitlabにはgitlab.yml

の次の設定があります。
email:
  from: notify@gitlabhq.com
  host: gitlabhq.com
.

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

どうやってそうですか?

役に立ちましたか?

解決

これは私も混乱しています。しかし、メール設定を変更するには、config / environments / exachion.rbでそれらを編集するだけで、通常のRailsアプリのようにconfig.action_mailer.smtp_settingsを追加します。

他のヒント

今それはgitlab 5.2 +で完全に異なります。

"/home/git/gitlab/config/initializers/smtp_settings.rb.sample"にあり、その説明の指示に従う必要があります。

:この方法は、gitlabの古いバージョンに役立ちました。新しいバージョンのための答えを参照してください。


config / onnerments / 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 => 'gitlab@yourserver.com',
      :password => 'yourPassword',
      :enable_starttls_auto => true
  }
.

可能な構成の詳細については、ActionMailerのマニュアルを参照してください。 http://api.rubyonrails.org/classes/actionmailer/base.html

:gitlab update

の後に再度ファイルを編集する必要があるかもしれません。

gitlab> 7 OMNIBUS、以下のように/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

email:host:gitlab.yml設定は、実際にはメールサーバー/ SMTPホストではありません。それはあなたのgitlabホストへのリンクを電子メールで構築するために使用されます。私たちはgitlabサーバー 'gitlab.local'(そしてそれのためのDNSエントリを持っています)と呼んでいるので、私たちの構成はhost: gitlab.localと言います。

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

そこに冗長な構成があります。GITクローンのURLをGITLAB内で正しく表示するには、同じホスト名で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:を変更してください。

これは/ 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 => '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
.

この質問が最初に尋ねられてから、どうやらこれらの設定の場所が変わりました(数回)。現在2018-11-02現在:

設定は公式のドキュメントに従ってgitlab.rbにあります。

href="https://i.stack.imgur.com/b9zij.png" rel="nofollow noreferrer"> 画像の説明が入力されています

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top