Sha256: db1dd46938e7ab66017acc25610f5e2e27bc9a6000cb9883659cc039591df9ad

Contents?: true

Size: 886 Bytes

Versions: 5

Compression:

Stored size: 886 Bytes

Contents

module MyForum
  class UserMailer < ApplicationMailer
    def reset_password_email(user)
      @user = user

      o = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten
      @new_password = (0...10).map { o[rand(o.length)] }.join

      @user.password = @new_password
      @user.save
      mail(to: @user.email, subject: 'vaz.od.ua - New password')
    end

    def custom_email(email:, subject:, message:)
      @message = message
      mail(to: email, subject: subject)
    end

    def pm_notification(user, sender)
      @sender = sender
      mail(to: user.email, subject: I18n.t('my_forum.mailer.new_pm_notification_subject'))
    end

    def ping_from_post(user, topic, page)
      @topic      = topic
      @topic_name = topic.name
      @page       = page
      mail(to: user.email, subject: I18n.t('my_forum.mailer.ping_user', topic_name: @topic_name))
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
my_forum-0.0.2.4 app/mailers/my_forum/user_mailer.rb
my_forum-0.0.2.3 app/mailers/my_forum/user_mailer.rb
my_forum-0.0.2.2 app/mailers/my_forum/user_mailer.rb
my_forum-0.0.2.1 app/mailers/my_forum/user_mailer.rb
my_forum-0.0.2 app/mailers/my_forum/user_mailer.rb