Sha256: ca9f5196727e08a24a980adeb45edeafefa4d8dac1e05d9318ca7f4d5a300a07

Contents?: true

Size: 871 Bytes

Versions: 3

Compression:

Stored size: 871 Bytes

Contents

class EmailMailer < ActionMailer::Base
    
  include ActionView::Helpers::TagHelper
  include ActionView::Helpers::TextHelper
  
  default_url_options[:host] = Spree::Config[:site_url]
    
  def with_layout(email, subscriber)
    @email           = email
    @subscriber      = subscriber
    @email_subject   = @email.render(:subject, @subscriber)
    @text            = @email.render(:body,    @subscriber)
    @base_url        = "http://#{Spree::Config[:site_url]}"
    @link_to_browser = read_email_url(@subscriber.token, @email.token)
    
    unless @email.nil? || @email_subject.empty? || @text.empty?
      mail(:to => @subscriber.email, :from => @email.from, :subject => @email_subject) do |format|
        format.text { render :text   => @text }
        format.html { render :layout => 'email', :text => simple_format(@text) }
      end
    end
  end
    
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_mail-0.40.0.4 app/mailers/email_mailer.rb
spree_mail-0.40.0.3 app/mailers/email_mailer.rb
spree_mail-0.40.0.2 app/mailers/email_mailer.rb