Rails三兩事 A website introduce you ruby&rails and technology news.

6Jun/100

Heroku send by Gmail

在Rails上透過Gmail寄信是蠻簡單的.
但網站搬到Heroku後最近發現似乎寄信有問題?
一查之下才知道要裝套件,官方網站其實就有,不過自己還是做個紀錄.

1.Install Plugin

$ script/plugin install git://github.com/adamwiggins/gmail_smtp.git

2.設定帳號

$ export GMAIL_SMTP_USER=username@gmail.com
$ export GMAIL_SMTP_PASSWORD=yourpassword

3.設定Heroku

$ heroku config:add GMAIL_SMTP_USER=username@gmail.com
$ heroku config:add GMAIL_SMTP_PASSWORD=yourpassword

完成. :D