class EmailNotifier

File

email_notifier.rb

(C)

Hipposoft 2007

Purpose

Send out e-mail messages when important things happen.


24-Dec-2007 (ADH): Created.

Public Instance Methods

admin_update_notification( user ) click to toggle source

Send a message to a user when their account settings are changed. Pass the User object representing the updated account.

# File app/models/email_notifier.rb, line 37
def admin_update_notification( user )
  @user = user

  mail(
    :to      => "#{ user.name } <#{ user.email }>",
    :from    => EMAIL_ADMIN,
    :subject => "#{ EMAIL_PREFIX }Your account has been configured"
  )
end
signup_notification( user ) click to toggle source

Send a message to the administrator when a new user signs up. Pass the new User object.

# File app/models/email_notifier.rb, line 15
def signup_notification( user )
  @user        = user
  @account_url = url_for(
    {
      :protocol   => 'https',
      :host       => EMAIL_HOST,
      :controller => 'users',
      :action     => 'edit',
      :id         => user.id
    }
  )

  mail(
    :to      => EMAIL_ADMIN,
    :from    => EMAIL_ADMIN,
    :subject => "#{ EMAIL_PREFIX }A new user has signed up"
  )
end