今天部署Redmine后,需要实现项目出现一些动作时需要发送邮件的需求。所以需要配置Redmine使邮件发送功能正常。
下面是我的配置过程:
<span style="white-space:pre"> </span>配置环境:
Centos 7
<span style="white-space:pre"> bitnami-redmine-3.1.1-1-linux-x64-installer.run</span>
<span style="white-space:pre"> </span>邮箱服务器:公司内部企业邮箱服务器
1.请保证安装好Redmine,可运行
2.进入redmine-3.1.1-1/apps/redmine/htdocs/config,修改configuration.yml文件
将内容拉到最底部,会看到一个
<span style="white-space:pre"> </span>production:
在下面添加内容(在production下配置内容会覆盖默认配置):
delivery_method: :smtp
smtp_settings:
enable_starttls_auto: false
address: "你的邮箱服务器SMTP地址"
port: 25
domain: "<span style="font-family: Arial, Helvetica, sans-serif;">你的邮箱服务器SMTP地址</span>"
authentication: :plain
user_name: "你的邮箱地址"
password: "密码"
重启redmine即可正常使用。
下面是一些注意事项:
1.请不要在该配置文件中使用 Tab键请不要在该配置文件中使用 Tab键 请不要在该配置文件中使用 Tab键(重要的事说三遍),建议使用两个空格作为缩进格式,复制改文章配置时,请确保每行配置使用的不是Tab分隔符
2.delivery_method 有四个值
smtp smtp同步模式新建或更新问题时立即发送邮件
async_smtp smtp异步模式 smtp异步方式发送邮件,发送mail和操作同步进行--测试时,出现不能收到邮件的情况,查看文档发现没有这个配置,还需继续了解(http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration)
sendmail sendmail同步模式(使用sendmail请先确保安装了sendMail)
async_sendmail sendmail异步模式(使用sendmail请先确保安装了sendMail)
附 使用sendMail发送只要将delivery_method 改为对应的模式即可
3.其它未实测配置
gmail邮件配置
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
enable_starttls_auto: true
address: "smtp.gmail.com"
port: '587'
domain: "smtp.gmail.com"
authentication: :plain
user_name: "your_email@gmail.com"
password: "your_password"
无认证邮件配置
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: smtp.knology.net
port: 25
domain: cybersprocket.com
authentication: :none
4.这里说个小技巧,在配置中,有三个属性分别为
tls: true
enable_starttls_auto: false
openssl_verify_mode: 'none'
如果出现配置后不能正常使用邮箱服务或者不能启动redmine的情况,请灵活增删或修改这三个属性的值