email.rb

Path: lib/ramaze/contrib/email.rb
Last Update: Fri Jul 02 04:10:13 +0000 2010

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!"
  )

Required files

net/smtp  

[Validate]