Gitlab改使用GMail SMTP

  1. 檢查 config/environments/production.rb 檔案,查看
    config.action_mailer.delivery_method = :sendmail
    的註解是否已增加,關閉Gitlab sendmail寄送服務
    config.action_mailer.delivery_method = :sendmail

[註] 使用這一篇 使用GMail SMTP寄信 (Ubuntu) 的方法應該也可以~但是目前會出現
“Mail failure – no recipient addresses”
A message that you sent using the -t command line option contained no
addresses that were not also on the command line, and were therefore
suppressed. This left no recipient addresses, and so no delivery could
be attempted.
的錯誤,所已先改用gitlab直接使用google的smtp

  1. 在 config/environments/production.rb 檔案加入
    config.action_mailer.raise_delivery_errors = true
    config.action_mailer.delivery_method = :smtp
    config.action_mailer.perform_deliveries = true
    config.action_mailer.smtp_settings = {
    :address => "smtp.gmail.com",
    :port => 587,
    :domain => "你的網站位置",
    :authentication => :plain,
    :user_name => "你的GMAIL帳號",
    :password => "你的GMAIL密碼",
    :enable_starttls_auto => true
    }

  2. 修改config/gitlab.yml檔案,將email_from修改為gmail帳號
    email_from: 你的GMAIL帳號

  3. 重啟gitlab服務
    service gitlab restart

  4. 修改gitlab使用者project權限,測試有沒有成功

This entry was posted in Git, Ubuntu. Bookmark the permalink.