Sha256: 0d9e2389aabb1c4016fe4e669954d863598bfd9677d987420f8f9291cc02e2b3

Contents?: true

Size: 1.22 KB

Versions: 12

Compression:

Stored size: 1.22 KB

Contents

class Mailboxer::MessageMailer < Mailboxer::BaseMailer
  #Sends and email for indicating a new message or a reply to a receiver.
  #It calls new_message_email if notifing a new message and reply_message_email
  #when indicating a reply to an already created conversation.
  def send_email(message, receiver)
    if message.conversation.messages.size > 1
      reply_message_email(message,receiver)
    else
      new_message_email(message,receiver)
    end
  end

  #Sends an email for indicating a new message for the receiver
  def new_message_email(message,receiver)
    @message  = message
    @receiver = receiver
    set_subject(message)
    mail :to => receiver.send(Mailboxer.email_method, message),
         :subject => t('mailboxer.message_mailer.subject_new', :subject => @subject),
         :template_name => 'new_message_email'
  end

  #Sends and email for indicating a reply in an already created conversation
  def reply_message_email(message,receiver)
    @message  = message
    @receiver = receiver
    set_subject(message)
    mail :to => receiver.send(Mailboxer.email_method, message),
         :subject => t('mailboxer.message_mailer.subject_reply', :subject => @subject),
         :template_name => 'reply_message_email'
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
mailboxer-0.15.1 app/mailers/mailboxer/message_mailer.rb
mailboxer-0.15.0 app/mailers/mailboxer/message_mailer.rb
mailboxer-0.14.0 app/mailers/mailboxer/message_mailer.rb
mailboxer-0.13.0 app/mailers/mailboxer/message_mailer.rb
mailboxer-0.12.5 app/mailers/mailboxer/message_mailer.rb
mailboxer-0.12.4 app/mailers/mailboxer/message_mailer.rb
mailboxer-0.12.3 app/mailers/mailboxer/message_mailer.rb
mailboxer-0.12.2 app/mailers/mailboxer/message_mailer.rb
mailboxer-0.12.1 app/mailers/mailboxer/message_mailer.rb
mailboxer-0.12.0 app/mailers/mailboxer/message_mailer.rb
mailboxer-0.12.0.rc2 app/mailers/mailboxer/message_mailer.rb
mailboxer-0.12.0.rc1 app/mailers/mailboxer/message_mailer.rb