在Ruby on Rails環境下要發送email,以下是步驟:
一.修改設定檔
修改config/application.rb,加入以下
config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { address: 'smtp.gmail.com' , port: 587 , domain: 'gmail.com' , user_name: 'your mail address' , password: 'your mail password' , authentication: 'plain' , enable_starttls_auto: true } |