博客园 首页 私信博主 显示目录 隐藏目录 管理 动画

gitlab 配置邮箱服务

gitlab 配置邮箱服务

查看gitlab容器,并进入容器

docker ps -a 
docker exec -it gitlab bash

修改gitlab配置文件

进入配置文件

vim /etc/gitlab/gitlab.rb

生效下面的配置项

### Email Settings
 gitlab_rails['gitlab_email_enabled'] = true
 gitlab_rails['gitlab_email_from'] = 'email@126.com'
 gitlab_rails['gitlab_email_display_name'] = 'GitLab'
 gitlab_rails['gitlab_email_reply_to'] = 'noreply@gitlab'
 gitlab_rails['gitlab_email_subject_suffix'] = ''
 gitlab_rails['gitlab_email_smime_enabled'] = false
 gitlab_rails['gitlab_email_smime_key_file'] = '/etc/gitlab/ssl/gitlab_smime.key'
 gitlab_rails['gitlab_email_smime_cert_file'] = '/etc/gitlab/ssl/gitlab_smime.crt'
 gitlab_rails['gitlab_email_smime_ca_certs_file'] = '/etc/gitlab/ssl/gitlab_smime_cas.crt'  

 gitlab_rails['smtp_enable'] = true
 gitlab_rails['smtp_address'] = "smtp.126.com"
 gitlab_rails['smtp_port'] = 465
 gitlab_rails['smtp_user_name'] = "gitlab@126.com"
 gitlab_rails['smtp_password'] = "*******"
 gitlab_rails['smtp_domain'] = "126.com"
 gitlab_rails['smtp_authentication'] = "login"
 gitlab_rails['smtp_enable_starttls_auto'] = true
 gitlab_rails['smtp_tls'] = true
###! **Can be: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert'**
###! Docs: http://api.rubyonrails.org/classes/ActionMailer/Base.html
 gitlab_rails['smtp_openssl_verify_mode'] = 'none'

 gitlab_rails['smtp_ca_path'] = "/etc/ssl/certs"
 gitlab_rails['smtp_ca_file'] = "/etc/ssl/certs/ca-certificates.crt"  

退出保存 然后生效配置并重启

gitlab-ctl reconfigure
gitlab-ctl restart

验证邮箱

gitlab-rails console
Notify.test_email('ants_double@qq.com', 'title', 'body').deliver_now

参考文章

https://www.cnblogs.com/daboluo/p/17004060.html
https://blog.csdn.net/weibin1101/article/details/119218283
https://blog.51cto.com/mouday/5057653
https://blog.csdn.net/qq_31417067/article/details/128517070

posted @ 2023-04-10 15:42  ants_double  阅读(140)  评论(0编辑  收藏  举报