Class: TMail::MimeEncodeSingle

Inherits:
Object
  • Object
show all
Defined in:
lib/action_mailer/vendor/tmail-1.2.3/tmail/net.rb

Overview

:stopdoc:

Instance Method Summary collapse

Instance Method Details

#exec(mail) ⇒ Object



205
206
207
208
209
210
211
212
213
# File 'lib/action_mailer/vendor/tmail-1.2.3/tmail/net.rb', line 205

def exec( mail )
  mail.mime_version = '1.0'
  b = mail.body
  if NKF.guess(b) != NKF::BINARY
    on_text b
  else
    on_binary b
  end
end

#on_binary(body) ⇒ Object



221
222
223
224
225
# File 'lib/action_mailer/vendor/tmail-1.2.3/tmail/net.rb', line 221

def on_binary( body )
  mail.body = [body].pack('m')
  mail.set_content_type 'application', 'octet-stream'
  mail.encoding = 'Base64'
end

#on_text(body) ⇒ Object



215
216
217
218
219
# File 'lib/action_mailer/vendor/tmail-1.2.3/tmail/net.rb', line 215

def on_text( body )
  mail.body = NKF.nkf('-j -m0', body)
  mail.set_content_type 'text', 'plain', {'charset' => 'iso-2022-jp'}
  mail.encoding = '7bit'
end