lib/action_mailer/base.rb in actionmailer-4.1.7.1 vs lib/action_mailer/base.rb in actionmailer-4.1.8
- old
+ new
@@ -757,11 +757,10 @@
# end
#
def mail(headers = {}, &block)
return @_message if @_mail_was_called && headers.blank? && !block
- @_mail_was_called = true
m = @_message
# At the beginning, do not consider class default for content_type
content_type = headers[:content_type]
@@ -785,9 +784,11 @@
assignable = headers.except(:parts_order, :content_type, :body, :template_name, :template_path)
assignable.each { |k, v| m[k] = v }
# Render the templates and blocks
responses = collect_responses(headers, &block)
+ @_mail_was_called = true
+
create_parts_from_responses(m, responses)
# Setup content type, reapply charset and handle parts order
m.content_type = set_content_type(m, content_type, headers[:content_type])
m.charset = charset