private Method

Base.create_mail

There's no documentation for this item.

Source Code

# File action_mailer/base.rb, line 542
def create_mail
  m = TMail::Mail.new

  m.subject, = quote_any_if_necessary(charset, subject)
  m.to, m.from = quote_any_address_if_necessary(charset, recipients, from)
  m.bcc = quote_address_if_necessary(bcc, charset) unless bcc.nil?
  m.cc  = quote_address_if_necessary(cc, charset) unless cc.nil?

  m.mime_version = mime_version unless mime_version.nil?
  m.date = sent_on.to_time rescue sent_on if sent_on
  headers.each { |k, v| m[k] = v }

  real_content_type, ctype_attrs = parse_content_type

  if @parts.empty?
    m.set_content_type(real_content_type, nil, ctype_attrs)
    m.body = Utils.normalize_new_lines(body)
  else
    if String === body
      part = TMail::Mail.new
      part.body = Utils.normalize_new_lines(body)
      part.set_content_type(real_content_type, nil, ctype_attrs)
      part.set_content_disposition "inline"
      m.parts << part
    end

    @parts.each do |p|
      part = (TMail::Mail === p ? p : p.to_mail(self))
      m.parts << part
    end

    if real_content_type =~ /multipart/
      ctype_attrs.delete "charset"
      m.set_content_type(real_content_type, nil, ctype_attrs)
    end
  end

  @mail = m
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.