Return to Snippet

Revision: 20859
at November 27, 2009 23:21 by PhilK


Initial Code
require "action_mailer"
 
class Notifier < ActionMailer::Base
  def email(address)
    recipients  "[email protected]"
    from        "[email protected]"
    subject     "Hello World"
    body        address
  end
end
 
# TLS settings are for gmail, not needed for other mail hosts.
Notifier.delivery_method = :smtp
Notifier.smtp_settings = {
  :tls => true,
  :enable_starttls_auto => true,
  :address => "smtp.gmail.com",
  :port => 587,
  :domain => "yourdomain.com",
  :user_name => "[email protected]",
  :password => "12345",
  :authentication => :plain
}
 
Notifier.deliver_email("[email protected]")

Initial URL


Initial Description
Simple example for using ActionMailer with Gmail (or other hosts if you remove the TLS settings).

Initial Title
ActionMailer Gmail Example

Initial Tags
ruby

Initial Language
Ruby