require 'rubygems'
require 'action_mailer'

ActionMailer::Base.server_settings = {
  :address => 'mail.your-domain.com',
  :port => 25,
  :authentication => :login,
  :user_name => 'username',
  :password => 'password',
}

class Emailer < ActionMailer::Base
  def test_email(email_address, email_body)
    recipients(email_address)
    from 'me@myDomain.net'
    subject 'This is a test e-mail'
    body email_body
  end
end

Emailer.deliver_test_email('me@myDomain.net', 'This is a test e-mail!')

Author

发表评论

电子邮件地址不会被公开。 必填项已用*标注