method
create!

Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: ActionMailer::Base
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0 (0)
- 2.2.1 (0)
- 2.3.8 (0)
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0
- 7.1.3.2
- 7.1.3.4
- What's this?
Related methods
- Class methods (29)
-
controller_path
-
default
-
default_options=
-
deliver (<= v2.3.8)
-
deliver_mail
-
email_address_with_name
-
mailer_name
-
matches_dynamic_method?
(<= v2.3.8)
-
method_missing
-
new
-
observer_class_for
-
receive (<= v6.0.0)
-
register_interceptor
-
register_interceptors
-
register_observer
-
register_observers
-
register_template_extension (<= v2.2.1)
-
respond_to? (<= v4.2.9)
-
respond_to_missing?
-
server_settings (<= v1.2.6)
-
server_settings= (<= v1.2.6)
-
set_payload_for_mail
-
supports_path?
-
template_root (<= v2.3.8)
-
template_root= (<= v2.3.8)
-
unregister_interceptor
-
unregister_interceptors
-
unregister_observer
-
unregister_observers
- Instance methods (42)
-
apply_defaults
-
assign_headers_to_message
-
attachments
-
candidate_for_layout?
(<= v2.3.8)
-
collect_responses
-
collect_responses_and_parts...
(<= v3.2.13)
-
collect_responses_from_block
-
collect_responses_from_temp...
-
collect_responses_from_text
-
compute_default
-
controller_name (<= v2.3.8)
-
controller_path (<= v2.3.8)
-
create! (<= v2.3.8)
-
create_mail
(<= v2.3.8)
-
create_parts_from_responses
-
default_i18n_subject
-
default_template_format
(<= v2.3.8)
-
deliver! (<= v2.3.8)
-
each_template
-
email_address_with_name
-
headers
-
initialize_defaults
(<= v2.3.8)
-
initialize_template_class
(<= v2.3.8)
-
insert_part
-
instrument_name
-
instrument_payload
-
mail
-
mailer_name
-
mailer_name= (<= v2.3.8)
-
perform_delivery_sendmail
(<= v2.3.8)
-
perform_delivery_smtp
(<= v2.3.8)
-
perform_delivery_test
(<= v2.3.8)
-
process
-
_protected_ivars
-
render
(<= v2.3.8)
-
render_message
(<= v2.3.8)
-
set_content_type
-
sort_parts
(<= v2.3.8)
-
template_path
(<= v2.3.8)
-
template_root
(<= v2.3.8)
-
template_root=
(<= v2.3.8)
-
wrap_inline_attachments
= private
= protected
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here.
These similar methods exist in v7.1.3.2:
create!(method_name, *parameters)
public Initialize the mailer via the given method_name. The body will be rendered and a new TMail::Mail object created.
Show source
# File actionmailer/lib/action_mailer/base.rb, line 457 def create!(method_name, *parameters) #:nodoc: initialize_defaults(method_name) __send__(method_name, *parameters) # If an explicit, textual body has not been set, we check assumptions. unless String === @body # First, we look to see if there are any likely templates that match, # which include the content-type in their file name (i.e., # "the_template_file.text.html.erb", etc.). Only do this if parts # have not already been specified manually. if @parts.empty? Dir.glob("#{template_path}/#{@template}.*").each do |path| template = template_root["#{mailer_name}/#{File.basename(path)}"] # Skip unless template has a multipart format next unless template && template.multipart? @parts << Part.new( :content_type => template.content_type, :disposition => "inline", :charset => charset, :body => render_message(template, @body) ) end unless @parts.empty? @content_type = "multipart/alternative" if @content_type !~ /^multipart/ @parts = sort_parts(@parts, @implicit_parts_order) end end # Then, if there were such templates, we check to see if we ought to # also render a "normal" template (without the content type). If a # normal template exists (or if there were no implicit parts) we render # it. template_exists = @parts.empty? template_exists ||= template_root["#{mailer_name}/#{@template}"] @body = render_message(@template, @body) if template_exists # Finally, if there are other message parts and a textual body exists, # we shift it onto the front of the parts and set the body to nil (so # that create_mail doesn't try to render it in addition to the parts). if !@parts.empty? && String === @body @parts.unshift Part.new(:charset => charset, :body => @body) @body = nil end end # If this is a multipart e-mail add the mime_version if it is not # already set. @mime_version ||= "1.0" if !@parts.empty? # build the mail object itself @mail = create_mail end