Path: | lib/ramaze/contrib/email.rb |
Last Update: | Tue Feb 01 12:28:13 +0000 2011 |
EmailHelper can be used as a simple way to send basic e-mails from your app.
Usage:
require 'ramaze/contrib/email' # Set the required traits: Ramaze::EmailHelper.trait :smtp_server => 'smtp.your-isp.com', :smtp_helo_domain => "originating-server.com", :smtp_username => 'username', :smtp_password => 'password', :sender_address => 'no-reply@your-domain.com' # Optionally, set some other traits: Ramaze::EmailHelper.trait :smtp_auth_type => :login, :bcc_addresses => [ 'admin@your-domain.com' ], :sender_full => 'MailBot <no-reply@your-domain.com>', :id_generator => lambda { "<#{Time.now.to_i}@your-domain.com>" }, :subject_prefix => "[SiteName]"
To send an e-mail:
Ramaze::EmailHelper.send( "foo@foobarmail.com", "Your fooness", "Hey, you are very fooey!" )