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
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
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
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
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