lib/jpmobile/mailer.rb in jpmobile-5.0.0 vs lib/jpmobile/mailer.rb in jpmobile-5.0.1
- old
+ new
@@ -1,18 +1,17 @@
-# -*- coding: utf-8 -*-
require 'jpmobile/mail'
require 'jpmobile/lookup_context'
Jpmobile::Email.japanese_mail_address_regexp = Regexp.new(/\.jp(?:[^a-zA-Z\.\-]|$)/)
module Jpmobile
module Mailer
class Base < ActionMailer::Base
self._view_paths = self._view_paths.dup
- self.view_paths.unshift(Jpmobile::Resolver.new(File.join(::Rails.root, "app/views")))
+ self.view_paths.unshift(Jpmobile::Resolver.new(File.join(::Rails.root, 'app/views')))
- def mail(headers={}, &block)
+ def mail(headers = {}, &block)
tos = headers[:to] || self.default_params[:to]
tos = tos.split(/,/)
@mobile = if tos.size == 1
# for mobile
@@ -25,19 +24,20 @@
@mobile.decorated = headers.delete(:decorated)
m = super(headers, &block)
- m.mobile = @mobile
+ m.mobile = @mobile
# for decorated-mail manipulation
m.rearrange! if @mobile.decorated?
m
end
class << self
protected
+
def set_payload_for_mail(payload, mail) #:nodoc:
super
payload[:mail] = Jpmobile::Util.ascii_8bit(mail.encoded).gsub(/\r\n/, "\n")
end