class ContactMailer

Public Instance Methods

new_contact(email, message) click to toggle source

Visitors of app send message to provided emails

# File app/mailers/contact_mailer.rb, line 28
def new_contact(email, message)
  @email = email
  @message = message
  mail(:subject => "Message from a #{Configurations::General.application_name} user") do |format|
    format.html { render :layout => 'mailer' }
  end
end
no_result_found(keyword, user) click to toggle source

send email if not able to search the requested keyword from visitor

# File app/mailers/contact_mailer.rb, line 45
def no_result_found(keyword, user)
  @keyword = keyword
  mail(:subject => "No result found - #{Configurations::General.application_name} search Engine") do |format|
    format.html { render :layout => 'mailer' }
  end
end
offline_chat(message, receiver) click to toggle source

Send notification email to user when someone send message to user if user is offline.

# File app/mailers/contact_mailer.rb, line 4
  def offline_chat(message, receiver)
    offline_reply_to = "support@tutor.co" # Staging Email Precessor ID
#  offline_reply_to = "inbound@tutor1.bymail.in" # Local Email Precessor ID
    begin
      @name = message.sender.name
      @message = message.message
      @time = message.created_at.strftime('%d-%b-%Y %I:%M%p')
      @image = message.sender.image_url
      @recipient_email = receiver.email
      @from_id = message.sender.id
      @to_id = receiver.id
      mail(
        :from => message.sender.email,
        :to => @recipient_email,
        :subject => "New chat message from #{@name}",
        :reply_to => offline_reply_to) do |format|
          format.html {render layout: 'mailer'}
        end
    rescue => e
      Rails.logger.debug("Exceptions #{e}")
    end
  end
search_for_tutor(details) click to toggle source

send email with the search result of Tutor, subject, Course

# File app/mailers/contact_mailer.rb, line 37
def search_for_tutor(details)
  @details = details
  mail(:subject => "#{Tutor.model_name.human} search request. subject:#{details[:subject]}, course:#{details[:course]} - #{Configurations::General.application_name}") do |format|
    format.html { render :layout => 'mailer' }
  end
end
send_message(name,email,subject,message,rcpt_email,sender_type) click to toggle source

To send message over the email.

# File app/mailers/contact_mailer.rb, line 53
def send_message(name,email,subject,message,rcpt_email,sender_type)
  @name = name
  @sender_email = email
  @recipient_email = rcpt_email
  @subject = subject
  @message = message
  @sender_type = sender_type
  mail(:to => @recipient_email,:subject => "#{@subject} - #{Configurations::General.application_name}") do |format|
    format.html { render :layout => 'mailer' }
  end
end