From 88ba056043e22c4c60dde6b07df897e502f49491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 25 Dec 2009 21:46:01 +0100 Subject: Refactor multiple parts logic and move Utils to PartContainer. --- actionmailer/lib/action_mailer/part_container.rb | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'actionmailer/lib/action_mailer/part_container.rb') diff --git a/actionmailer/lib/action_mailer/part_container.rb b/actionmailer/lib/action_mailer/part_container.rb index abfd8f8426..3fe502b1fb 100644 --- a/actionmailer/lib/action_mailer/part_container.rb +++ b/actionmailer/lib/action_mailer/part_container.rb @@ -39,8 +39,24 @@ module ActionMailer end private - - def parse_content_type(defaults=nil) + + def normalize_new_lines(text) #:nodoc: + text.to_s.gsub(/\r\n?/, "\n") + end + + def setup_multiple_parts(mailer, real_content_type, ctype_attrs) #:nodoc: + @parts.each do |p| + part = (TMail::Mail === p ? p : p.to_mail(self)) + mailer.parts << part + end + + if real_content_type =~ /multipart/ + ctype_attrs.delete "charset" + mailer.set_content_type(real_content_type, nil, ctype_attrs) + end + end + + def parse_content_type(defaults=nil) #:nodoc: if content_type.blank? return defaults ? [ defaults.content_type, { 'charset' => defaults.charset } ] : -- cgit v1.2.3