Class: AlchemyCrm::MailingsMailer
- Inherits:
-
ActionMailer::Base
- Object
- ActionMailer::Base
- AlchemyCrm::MailingsMailer
- Defined in:
- app/mailers/alchemy_crm/mailings_mailer.rb
Instance Method Summary collapse
-
#build(mailing, recipient, options = {}) ⇒ Object
Renders the email sent to the mailing recipient It takes the layout from
layouts/alchemy_crm/mailings.erb
and renders a html and a text part from it. -
#configuration(name) ⇒ Object
Proxy to Alchemy config for view helpers.
-
#default_url_options ⇒ Object
Setting default url options for rails url_for helpers.
-
#logged_in? ⇒ Boolean
Faking that we are not logged in.
-
#session ⇒ Object
Simple session object that contains the language id for view helpers.
Instance Method Details
#build(mailing, recipient, options = {}) ⇒ Object
Renders the email sent to the mailing recipient It takes the layout from layouts/alchemy_crm/mailings.erb
and renders a html and a text part from it.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/mailers/alchemy_crm/mailings_mailer.rb', line 11 def build(mailing, recipient, = {}) @options = ::I18n.locale = @options[:locale] @mailing = mailing @page = @mailing.page @recipient = recipient @contact = @recipient.contact || Contact.new_from_recipient(@recipient) mail(:to => @recipient.mail_to, :subject => mailing.subject) do |format| format.text { render("layouts/alchemy_crm/mailings.text") } format.html { render("layouts/alchemy_crm/mailings.html") } end end |
#configuration(name) ⇒ Object
Proxy to Alchemy config for view helpers
31 32 33 |
# File 'app/mailers/alchemy_crm/mailings_mailer.rb', line 31 def configuration(name) Alchemy::Config.get(name) end |
#default_url_options ⇒ Object
Setting default url options for rails url_for helpers.
43 44 45 |
# File 'app/mailers/alchemy_crm/mailings_mailer.rb', line 43 def {:host => @options[:host], :port => @options[:port]} end |
#logged_in? ⇒ Boolean
Faking that we are not logged in
26 27 28 |
# File 'app/mailers/alchemy_crm/mailings_mailer.rb', line 26 def logged_in? false end |
#session ⇒ Object
Simple session object that contains the language id for view helpers.
36 37 38 39 40 |
# File 'app/mailers/alchemy_crm/mailings_mailer.rb', line 36 def session { :language_id => @options[:language_id] } end |