博主自建了Git服务器用来存储一些代码文档片段
配置邮箱服务的用途有合并请求时,邮件通知 账号注册时,邮件验证(由于个人使用已关闭注册) 修改密码时,通过邮件修改
00x1 配置教程
vim /etc/gitlab/gitlab.rb
按/后输入smtp_enable,找到下面这一串文本,进行修改
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp 发信地址"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "smtp 邮箱"
gitlab_rails['smtp_password'] = "smtp 密码"
gitlab_rails['smtp_domain'] = "qq.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
user['git_user_email'] = "smtp 邮箱"
gitlab_rails['gitlab_email_from'] = "smtp 邮箱"
按esc退出到命令行模式
之后:wq 保存并退出
gitlab-ctl reconfigure
gitlab-ctl restart
00x2 测试发信
gitlab-rails console
Notify.test_email('接收方邮件地址','邮件标题','邮件内容').deliver_now
------执行返回内容如下---------------
irb(main):001:0> Notify.test_email('bejix@qq.com','邮件标题','邮件内容').deliver_now
Notify#test_email: processed outbound mail in 1613.0ms
00x3 大功告成
Over!
评论(0)