Module: ActionMailer::OldApi

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/action_mailer/old_api.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#attachment(params, &block) ⇒ Object

Add an attachment to a multipart message. This is simply a part with the content-disposition set to “attachment”.



101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/action_mailer/old_api.rb', line 101

def attachment(params, &block)
  params = { :content_type => params } if String === params

  params[:content] ||= params.delete(:data) || params.delete(:body)

  if params[:filename]
    params = normalize_file_hash(params)
  else
    params = normalize_nonfile_hash(params)
  end

  part(params, &block)
end

#part(params) {|part| ... } ⇒ Object

Add a part to a multipart message, with the given content-type. The part itself is yielded to the block so that other properties (charset, body, headers, etc.) can be set on it.

Yields:



86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/action_mailer/old_api.rb', line 86

def part(params)
  params = {:content_type => params} if String === params

  if custom_headers = params.delete(:headers)
    params.merge!(custom_headers)
  end

  part = Mail::Part.new(params)

  yield part if block_given?
  @parts << part
end

#process(method_name, *args) ⇒ Object



73
74
75
76
77
78
79
80
81
# File 'lib/action_mailer/old_api.rb', line 73

def process(method_name, *args)
  initialize_defaults(method_name)
  super
  unless @mail_was_called
    create_parts
    create_mail
  end
  @_message
end