carmelyne (owner)

Revisions

gist: 64592 Download_button fork
public
Public Clone URL: git://gist.github.com/64592.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
class UserNotifier < ActionMailer::Base
  def signup_notification(user)
    setup_email(user)
    @subject += 'Please activate your new account'
    @body[:url] = "#{HOST}/activate/#{user.activation_code}"
  
  end
  
  def activation(user)
    setup_email(user)
    @subject += 'Your account has been activated!'
    @body[:url] = "Visit #{HOST}!"
  end
  
  def forgot_password(user)
    setup_email(user)
    @subject += 'You have requested to change your password'
    @body[:url] = "#{HOST}/reset_password/#{user.password_reset_code}"
  end
 
  def reset_password(user)
    setup_email(user)
    @subject += 'Your password has been reset.'
  end
  
  protected
    def setup_email(user)
      @recipients = "#{user.email}"
      # Sets the User FROM Name and Email
      @from = %("/Poke by carmelyne" <CT@yourrailsapp.com>)
      @subject = "[YourRailsApp] "
      @sent_on = Time.now
      @body[:user] = user
    end
end