Class: Spree::EmailTemplateMailer
- Inherits:
-
BaseMailer
- Object
- ActionMailer::Base
- BaseMailer
- Spree::EmailTemplateMailer
- Defined in:
- app/mailers/spree/email_template_mailer.rb
Overview
Sends an editable email template, rendered with sample data as the editor previews it, so a merchant can see it in a real inbox before publishing.
Instance Method Summary collapse
Methods inherited from BaseMailer
#current_store, #from_address, #mail, #money, #render_in_email_layout, #reply_to_address, #with_store_locale
Instance Method Details
#test_email(store, recipient, key, locale: nil, subject: nil, body: nil, record_id: nil, email_key: nil, branding: {}, mailer_logo_signed_id: nil, mailer_logo_cleared: false) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/mailers/spree/email_template_mailer.rb', line 16 def test_email(store, recipient, key, locale: nil, subject: nil, body: nil, record_id: nil, email_key: nil, branding: {}, mailer_logo_signed_id: nil, mailer_logo_cleared: false) @current_store = store email = Spree::EmailTemplates::Preview.new( store: store, key: key, locale: locale, subject: subject, body: body, record_id: record_id, email_key: email_key, branding: branding, mailer_logo_signed_id: mailer_logo_signed_id, mailer_logo_cleared: mailer_logo_cleared ).call mail(to: recipient, subject: I18n.t('spree.email_templates.test_email_subject', subject: email.subject)) do |format| format.text { render plain: email.text, layout: false } format.html { render html: email.html.html_safe, layout: false } end end |