# -*- encoding : utf-8 -*- class GeneralMails < ActionMailer::Base add_template_helper(MailHelper) layout 'mail' default from: "Market-Inn " def general(lang_slug, mail_type, email, options = {}) @options = options @mail_type = mail_type @lang = LangSite.find_by_slug(lang_slug.to_s) @mail_content = @mail_type.mail_contents.where(:lang_site_id => @lang.id).first subject = @mail_content.subject @arguments = @options[:arguments] @ccis = @options[:ccis] || [] @from = @options[:from] if @options[:from] if @from mail(:to => email, :subject => subject, :bcc => @ccis.join(";"), :from => @from) else mail(:to => email, :subject => subject, :bcc => @ccis.join(";")) end end def admin(email, subject, content, options = {}) @options = options @content = content @arguments = @options[:arguments] @ccis = @options[:ccis] || [] @from_admin = @options[:from_admin] if @options[:from_admin] mail(:to => email, :subject => "Notification ADMIN : "+subject.to_s, :bcc => @ccis.join(";")) end end