Rails 使用 ActionMailer 发送邮件

2019PHP高薪工程师学习路线图....>>>

require 'rubygems'
require 'action_mailer'

class Emailer < ActionMailer::Base
  def test_email(email_address, email_body)
    recipients(email_address)
    from "[email protected]"
    subject "This is a test e-mail"
    body email_body
  end
end

Emailer.deliver_test_email([email protected]', 'This is a test e-mail!')