문제

기본적으로 gitlab에는 다음 구성이 있습니다. gitlab.yml :

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

하지만 다른 메일 서버를 사용하려면 다른 변수(호스트, 포트, 사용자, 비밀번호 등)를 지정해야 합니다.

어떻게 해야 합니까?

도움이 되었습니까?

해결책

이것은 나를 혼란스럽게합니다.구성 / 환경 / Production.rb에서 편집하는 메일 설정을 변경하려면 일반 레일 앱과 같은 config.action_mailer.smtp_settings를 추가하십시오.

다른 팁

이제 GitLab 5.2 +에서 완전히 다릅니다.

"/home/git/gitlab/config/initializers/smtp_settings.rb.sample"에 있습니다. "라는 지침을 따라야합니다.

참고 :이 방법은 이전 버전의 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 => '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/, 기본값과 같습니다.

거기에 몇 가지 중복 구성이 있습니다.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:.

/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 공식 문서에 따르면:

enter image description here

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top