ตั้งค่า Redmine ให้ส่งเมล์ด้วย Server ของ Gmail
เนื่องจาก Hotmail มีนโยบายไม่รับเมล์จาก Server ส่วนใหญ่ในไทย จึงจำเป็นต้องหาวิธีส่งเมล์แบบอื่น วิธีนิยมที่สุดคือเปลี่ยนไปใช้ Mail Server ที่สามารถส่งเข้า Hotmail ได้ ในที่นี้จะใช้ Gmail ใน Google Apps
ขั้นตอนย่อๆ
- แก้ email.yml
- ลง TLS module
- แก้บั๊ก TLS module – -”
- restart apache
ขั้นตอนแบบละเอียด
- แก้ไฟล์
config/email.ymlในโฟลเดอร์ Redmine - ติดตั้ง TLS module โดยไปที่โฟลเดอร์ของ Redmine แล้วสั่ง
- Restart Apache
production:
delivery_method: :smtp
smtp_settings:
address: smtp.gmail.com
tls: true
port: 587
domain: project.in.th
authentication: :login
user_name: redmine@project.in.th
password: myredเนื่องจาก Gmail มันต้องส่งข้อมูลแบบเข้ารหัส เลยต้องเพิ่ม tls: true เข้าไปด้วย แต่ยังใช้
ruby script/plugin install http://svn.douglasfshearer.com/rails/plugins/action_mailer_optional_tls
ยัง! ยังใช้ไม่ได้ โมดูลนี้มันมีบั๊ก ต้องไปแก้ไฟล์ vendor/plugins/action_mailer_optional_tls/lib/smtp_tls.rb ก่อน
def do_tls_start(helodomain, user, secret, authtype) raise IOError, 'SMTP session already started' if @started check_auth_args user, secret, authtype if user or secret
แก้จากข้างบนเป็น (ลบ authtype ออก)
def do_tls_start(helodomain, user, secret, authtype) raise IOError, 'SMTP session already started' if @started check_auth_args user, secret if user or secret
/etc/init.d/apache2 restart
ทดลองส่งเมล์ได้โดยเข้า Redmine > Administration > Settings > Email notifications แล้วกด Send a test email ด้านล่าง ถ้าทุกอย่างถูกต้องก็จะมีเมล์ส่งมา

ลองเช็คดู header ของเมล์ที่ส่ง ควรจะมี mailed-by: mail-gx0-f26.google.com อาจแตกต่างกันบ้างเล็กน้อยแล้วแต่โดเมน แต่ต้องลงท้ายด้วย Google เท่านี้ก็ไม่มีปัญหาการส่งเมล์เข้า Hotmail แล้ว
ขอบคุณ: http://www.hiddentao.com/archives/2008/12/06/redmine-svn-mysql-5-lighttpd-15/
ไปเจอได้ไงว่ามีบั๊กตรงนั้นน่ะ