1. Visit the 'Backstage' admin area and create an email account for 'email_user' with password 'email_password'. At this point it should tell you the SMTP server is 'mail.mydomain.com'.
At this stage I decided that I would try to get it working in the console first. So I went to my application root and typed 'script/console production' and then
2. Set the configuration
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = { :address => "localhost",
:port => 25,
:authentication => :login,
:user_name => 'email_user+mydomain.com',
:password => 'email_password'
}3. Created a mailer
class Page < ActionMailer::Base
def about
recipients 'tom.closeman@gmail.com'
subject "Wey hey - it works - again"
from "email_user@forfolkssake.com"
end
end
This relied on the (blank) template 'App/Views/Page/about.html.erb' existing in my application folder.
4. Sent the message
Page.deliver_about
This then sent me the message. Which I thought was pretty cool.
No comments:
Post a Comment