gitlab的邮箱配置过程
2016-01-01 22:58
721 查看
新搭建的gitlab ce服务器需要支持邮件通知功能,记录下过程。
公司内部自建的邮件服务器,使用Centos默认安装的Postfix+ExtMail搭建。
在此基础上配置gitlab的通知邮件。
以下是完整的配置信息,真实信息已被修改if Rails.env.production?
Gitlab::Application.config.action_mailer.delivery_method = :smtp ActionMailer::Base.smtp_settings = {
#smtp服务器地址
address: “mail.company.com”,
#smtp服务端口
port: 25,
#内部邮件系统配置的邮箱
user_name: “gitlab@company.com”,
#邮箱的密码
password: “password”,
#邮件服务器的域名
domain: “company.com”,
authentication: :login,
enable_starttls_auto: false,
openssl_verify_mode: ‘none’ # See ActionMailer documentation for other possible options
}
end
## Email settings
# Email address used in the “From” field in mails sent by GitLab
#刚才配置的公司邮箱
email_from: gitlab@company.com
#发信人的名称,接收邮件时,显示在”发信人”里
email_display_name: GitLab CE
在Email中填入刚才配置的邮箱地址,点击下方的Save changes,
然后会出现”Please click the link in the confirmation email before continuing,it was sent to …”的字样。
如下图:
登录到邮箱中,会受到gitlab服务器发送来的确认邮件,如图:
点击”Confirm my account”确认信息
回到gitlab修改通知邮件的地方,会看到邮件已经修改过来了。如下图:
此时,创建新用户,并制定真实存在的邮箱,用户会收到gitlab服务器发送的创建用户邮件。
Gitlab::Application.config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: “smtp.163.com”,
port: 25,
user_name: “username”,
password: “123456”,
domain: “163.com”,
authentication: :plain,
enable_starttls_auto: true
}
end腾讯邮箱if Rails.env.production?
Gitlab::Application.config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: “smtp.exmail.qq.com”,
port: 25,
user_name: “username@company.com”,
password: “123456”,
domain: “smtp.qq.com”,
authentication: :plain,
enable_starttls_auto: true,
}
end
此方法仅在gitlab 7.X版本上做过测试,不保证其他版本可用;
公司内部自建的邮件服务器,使用Centos默认安装的Postfix+ExtMail搭建。
在此基础上配置gitlab的通知邮件。
1. 复制配置文件
1 2 | cd /home/git/gitlab sudo -u git -H cp config/initializers/smtp_settings.rb.sample config/initializers/smtp_setting.rb |
2. 编辑配置文件
1 | sudo -u git -H vim config/initializers/smtp_setting.rb |
Gitlab::Application.config.action_mailer.delivery_method = :smtp ActionMailer::Base.smtp_settings = {
#smtp服务器地址
address: “mail.company.com”,
#smtp服务端口
port: 25,
#内部邮件系统配置的邮箱
user_name: “gitlab@company.com”,
#邮箱的密码
password: “password”,
#邮件服务器的域名
domain: “company.com”,
authentication: :login,
enable_starttls_auto: false,
openssl_verify_mode: ‘none’ # See ActionMailer documentation for other possible options
}
end
3. 修改gitlab配置文件
1 2 | cd /home/git/gitlab sudo -u git -H vim config/gitlab.yml |
# Email address used in the “From” field in mails sent by GitLab
#刚才配置的公司邮箱
email_from: gitlab@company.com
#发信人的名称,接收邮件时,显示在”发信人”里
email_display_name: GitLab CE
4. 重启gitlab服务
1 | service gitlab restart |
5. Web端配置
在Web上登录gitlab服务器,点击右上角的设置,如图:在Email中填入刚才配置的邮箱地址,点击下方的Save changes,
然后会出现”Please click the link in the confirmation email before continuing,it was sent to …”的字样。
如下图:
登录到邮箱中,会受到gitlab服务器发送来的确认邮件,如图:
点击”Confirm my account”确认信息
回到gitlab修改通知邮件的地方,会看到邮件已经修改过来了。如下图:
此时,创建新用户,并制定真实存在的邮箱,用户会收到gitlab服务器发送的创建用户邮件。
6. 贴几个网上查到的163邮箱和腾讯邮箱的配置案例(没有验证过)
163邮箱if Rails.env.production?Gitlab::Application.config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: “smtp.163.com”,
port: 25,
user_name: “username”,
password: “123456”,
domain: “163.com”,
authentication: :plain,
enable_starttls_auto: true
}
end腾讯邮箱if Rails.env.production?
Gitlab::Application.config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: “smtp.exmail.qq.com”,
port: 25,
user_name: “username@company.com”,
password: “123456”,
domain: “smtp.qq.com”,
authentication: :plain,
enable_starttls_auto: true,
}
end
7. 其他说明
第二步中的配置使用于多数开源项目的邮件通知配置,至少公司的redmine的配置和这样一样;此方法仅在gitlab 7.X版本上做过测试,不保证其他版本可用;
相关文章推荐
- 建立企业信息化-重头开始
- C#实现线程安全的简易日志记录方法
- JS基于cookie实现来宾统计记录访客信息的方法
- 用VBS记录客户机操作的代码
- 从数据库中读取记录横向排列
- 检测邮箱地址是否合法 Check Mail Address (For: IE5+、FF1.06、Opera 7+ ...)[
- C++键盘记录程序代码
- PHP判断数据库中的记录是否存在的方法
- javascript 实现 秒杀,团购 倒计时展示的记录 分享
- MySQL生产库Insert了2次同样的记录但是主键ID是不一样的问题的分析过程
- 用 Win2003 架设邮件服务器 图文详解
- linux中 shell 历史命令记录功能
- php浏览历史记录的方法
- Golang记录、计算函数执行耗时、运行时间的一个简单方法
- Python socket.error: [Errno 98] Address already in use的原因和解决方法
- FileMaker 14学习笔记整理
- Exchange邮件服务器中的部署更改
- 关于awk与其它命令一起使用显示文本信息
- 华为防火墙安全策略配置
- SQL Server 2008安装图解及遇到的问题记录