Class | UserNotify
In: | app/models/user_notify.rb
Parent: | ActionMailer::Base

ユーザーに通知するメールのモデル。

### Methods

change_password forgot_password setup_email signup

### Public Instance methods

change_password(user, password, url=nil)

user に対して password への変更を通知する。

[Source]

        # File app/models/user_notify.rb, line 33
    33:   def change_password(user, password, url=nil)
    34:     setup_email(user)
    35:
    36:     # Email header info
    37:     @subject += s_("user_notify|Changed password notification")
    38:
    39:     # Email body substitutions
    40:     @body["name"] = user.name
    41:     @body["login"] = user.login
    42:     @body["password"] = password
    43:     @body["url"] = url || UserSystem::CONFIG[:app_url].to_s
    44:     @body["app_name"] = UserSystem::CONFIG[:app_name].to_s
    45:   end

forgot_password(user, url=nil)

user に対してパスワードを忘れた場合の通知を行う。

[Source]

        # File app/models/user_notify.rb, line 19
    19:   def forgot_password(user, url=nil)
    20:     setup_email(user)
    21:
    22:     # Email header info
    23:     @subject += s_("user_notify|Forgotten password notification")
    24:
    25:     # Email body substitutions
    26:     @body["name"] = user.name
    27:     @body["login"] = user.login
    28:     @body["url"] = url || UserSystem::CONFIG[:app_url].to_s
    29:     @body["app_name"] = UserSystem::CONFIG[:app_name].to_s
    30:   end

setup_email(user)

user 宛のメールを設定する。

[Source]

        # File app/models/user_notify.rb, line 48
    48:   def setup_email(user)
    49:     recipients user.email
    50:     from       UserSystem::CONFIG[:email_from].to_s
    51:     subject    "[#{UserSystem::CONFIG[:app_name]}] "
    52:     sent_on    Time.now
    53:     content_type "text/plain; charset=#{UserSystem::CONFIG[:mail_charset]}; format=flowed"
    54:   end

signup(user, password, url=nil)

user に対して password とともに登録を通知する。

[Source]

        # File app/models/user_notify.rb, line 4
     4:   def signup(user, password, url=nil)
     5:     setup_email(user)
     6:
     7:     # Email header info
     8:     @subject += s_("user_notify|Welcome to %{app_name}!") % {:app_name => UserSystem::CONFIG[:app_name]}
     9:
    10:     # Email body substitutions
    11:     @body["name"] = user.name
    12:     @body["login"] = user.login
    13:     @body["password"] = password
    14:     @body["url"] = url || UserSystem::CONFIG[:app_url].to_s
    15:     @body["app_name"] = UserSystem::CONFIG[:app_name].to_s
    16:   end

[Validate]