ref: master
plugins/orders_cycle/lib/orders_cycle_plugin/mailer.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
class OrdersCyclePlugin::Mailer < Noosfero::Plugin::MailerBase include OrdersCyclePlugin::TranslationHelper helper ApplicationHelper helper OrdersCyclePlugin::TranslationHelper attr_accessor :environment attr_accessor :profile def open_cycle profile, cycle, subject, message self.environment = profile.environment @profile = profile @cycle = cycle @message = message mail bcc: organization_members(@profile), to: environment.noreply_email, from: environment.noreply_email, reply_to: profile_recipients(@profile), subject: t('lib.mailer.profile_subject') % {profile: profile.name, subject: subject} end protected def profile_recipients profile if profile.person? profile.contact_email else profile.admins.map{ |p| p.contact_email } end end def organization_members profile if profile.organization? profile.members.map{ |p| p.contact_email } end end end |