Module: ActionMailer::OldApi

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

Overview

:nodoc:

Instance Method Summary collapse

Methods included from ActiveSupport::Concern

append_features, extended, included

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”.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'actionmailer/lib/action_mailer/old_api.rb', line 93

def attachment(params, &block)
  ActiveSupport::Deprecation.warn "attachment() is deprecated and will be removed in future versions. " <<
    "Please use the attachments[] API instead."
  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:



76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'actionmailer/lib/action_mailer/old_api.rb', line 76

def part(params)
  ActiveSupport::Deprecation.warn "part() is deprecated and will be removed in future versions. " <<
    "Please pass a block to mail() instead."
  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



63
64
65
66
67
68
69
70
71
# File 'actionmailer/lib/action_mailer/old_api.rb', line 63

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