From a84a08ecead89a33fc4694c55bd6cc0e34370fa0 Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Sun, 2 Jun 2013 20:41:21 +0200 Subject: No need to load 'rake/packagetask' as it's already in 'rubygems/package_task' --- actionmailer/Rakefile | 1 - 1 file changed, 1 deletion(-) (limited to 'actionmailer') diff --git a/actionmailer/Rakefile b/actionmailer/Rakefile index 45c238d302..d1134ba2b5 100644 --- a/actionmailer/Rakefile +++ b/actionmailer/Rakefile @@ -1,5 +1,4 @@ require 'rake/testtask' -require 'rake/packagetask' require 'rubygems/package_task' desc "Default Task" -- cgit v1.2.3 From 67f668845eef9e3c9472154e0b1fc0c673e49e7a Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Fri, 21 Jun 2013 10:57:00 +0200 Subject: Saying gemcutter => rubygems [ci skip] --- actionmailer/Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionmailer') diff --git a/actionmailer/Rakefile b/actionmailer/Rakefile index d1134ba2b5..457f3b7838 100644 --- a/actionmailer/Rakefile +++ b/actionmailer/Rakefile @@ -27,7 +27,7 @@ Gem::PackageTask.new(spec) do |p| p.gem_spec = spec end -desc "Release to gemcutter" +desc "Release to rubygems" task release: :package do require 'rake/gemcutter' Rake::Gemcutter::Tasks.new(spec).define -- cgit v1.2.3 From d88b390dfde606b7b9b2de77d8af50ca3ade43bd Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Fri, 21 Jun 2013 14:14:36 +0200 Subject: Adding verbose in isolated test. --- actionmailer/Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionmailer') diff --git a/actionmailer/Rakefile b/actionmailer/Rakefile index d1134ba2b5..0865a4bfbe 100644 --- a/actionmailer/Rakefile +++ b/actionmailer/Rakefile @@ -16,7 +16,7 @@ namespace :test do task :isolated do ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) Dir.glob("test/**/*_test.rb").all? do |file| - sh(ruby, '-Ilib:test', file) + sh(ruby, '-w', '-Ilib:test', file) end or raise "Failures" end end -- cgit v1.2.3 From 49185875a5cd7f7e7a0799e40787cb358d3ba741 Mon Sep 17 00:00:00 2001 From: Alex Tsukernik Date: Mon, 22 Jul 2013 14:23:53 -0400 Subject: don't convert mailer default values to procs Invoke mailer defaults as procs only if they are procs, do not convert with to_proc. That an object is convertible to a proc does not mean it's meant to be always used as a proc. Fixes #11533 --- actionmailer/CHANGELOG.md | 6 +++++- actionmailer/lib/action_mailer/base.rb | 2 +- actionmailer/test/base_test.rb | 4 ++++ actionmailer/test/mailers/proc_mailer.rb | 3 ++- 4 files changed, 12 insertions(+), 3 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/CHANGELOG.md b/actionmailer/CHANGELOG.md index 9e9d07b386..1659696bfb 100644 --- a/actionmailer/CHANGELOG.md +++ b/actionmailer/CHANGELOG.md @@ -1,3 +1,7 @@ -* No changes. +* invoke mailer defaults as procs only if they are procs, do not convert + with to_proc. That an object is convertible to a proc does not mean it's + meant to be always used as a proc. Fixes #11533 + + *Alex Tsukernik* Please check [4-0-stable](https://github.com/rails/rails/blob/4-0-stable/actionmailer/CHANGELOG.md) for previous changes. diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index fcdd6747b8..cc3a412221 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -685,7 +685,7 @@ module ActionMailer # Call all the procs (if any) class_default = self.class.default default_values = class_default.merge(class_default) do |k,v| - v.respond_to?(:to_proc) ? instance_eval(&v) : v + v.is_a?(Proc) ? instance_eval(&v) : v end # Handle defaults diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index b9c56c540d..b74728ae34 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -578,6 +578,10 @@ class BaseTest < ActiveSupport::TestCase assert(mail1.to_s.to_i > mail2.to_s.to_i) end + test 'default values which have to_proc (e.g. symbols) should not be considered procs' do + assert(ProcMailer.welcome['x-has-to-proc'].to_s == 'symbol') + end + test "we can call other defined methods on the class as needed" do mail = ProcMailer.welcome assert_equal("Thanks for signing up this afternoon", mail.subject) diff --git a/actionmailer/test/mailers/proc_mailer.rb b/actionmailer/test/mailers/proc_mailer.rb index 733633b575..7e189d861f 100644 --- a/actionmailer/test/mailers/proc_mailer.rb +++ b/actionmailer/test/mailers/proc_mailer.rb @@ -1,7 +1,8 @@ class ProcMailer < ActionMailer::Base default to: 'system@test.lindsaar.net', 'X-Proc-Method' => Proc.new { Time.now.to_i.to_s }, - subject: Proc.new { give_a_greeting } + subject: Proc.new { give_a_greeting }, + 'x-has-to-proc' => :symbol def welcome mail -- cgit v1.2.3 From 64202abc3d15663776b29654e415c2708611e237 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Fri, 26 Jul 2013 04:00:56 +0900 Subject: Don't mutate the Base settings by merge!ing the given value --- actionmailer/lib/action_mailer/delivery_methods.rb | 2 +- actionmailer/test/delivery_methods_test.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/delivery_methods.rb b/actionmailer/lib/action_mailer/delivery_methods.rb index 9a1a27c8ed..aedcd81e52 100644 --- a/actionmailer/lib/action_mailer/delivery_methods.rb +++ b/actionmailer/lib/action_mailer/delivery_methods.rb @@ -64,7 +64,7 @@ module ActionMailer raise "Delivery method cannot be nil" when Symbol if klass = delivery_methods[method] - mail.delivery_method(klass,(send(:"#{method}_settings") || {}).merge!(options || {})) + mail.delivery_method(klass, (send(:"#{method}_settings") || {}).merge(options || {})) else raise "Invalid delivery method #{method.inspect}" end diff --git a/actionmailer/test/delivery_methods_test.rb b/actionmailer/test/delivery_methods_test.rb index 61a037ea18..20412c7bb2 100644 --- a/actionmailer/test/delivery_methods_test.rb +++ b/actionmailer/test/delivery_methods_test.rb @@ -152,6 +152,9 @@ class MailDeliveryTest < ActiveSupport::TestCase assert_equal "overridden", delivery_method_instance.settings[:user_name] assert_equal "somethingobtuse", delivery_method_instance.settings[:password] assert_equal delivery_method_instance.settings.merge(overridden_options), delivery_method_instance.settings + + # make sure that overriding delivery method options per mail instance doesn't affect the Base setting + assert_equal settings, ActionMailer::Base.smtp_settings end test "non registered delivery methods raises errors" do -- cgit v1.2.3 From f52832de2ad67c4489b094d362425cf66ab29ced Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Fri, 26 Jul 2013 11:07:25 +0200 Subject: grab executable from rubygems As done here d7fc97d3f90c0e30865d32ce202658f03248cacc --- actionmailer/Rakefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/Rakefile b/actionmailer/Rakefile index 5d5539df1d..5ddd90020b 100644 --- a/actionmailer/Rakefile +++ b/actionmailer/Rakefile @@ -14,9 +14,8 @@ Rake::TestTask.new { |t| namespace :test do task :isolated do - ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) Dir.glob("test/**/*_test.rb").all? do |file| - sh(ruby, '-w', '-Ilib:test', file) + sh(Gem.ruby, '-w', '-Ilib:test', file) end or raise "Failures" end end -- cgit v1.2.3 From 938481010a63839f4a0ad87c92296917328729e4 Mon Sep 17 00:00:00 2001 From: Rajarshi Das Date: Fri, 2 Aug 2013 18:04:34 +0530 Subject: map => map! for stopping extra array creation --- actionmailer/lib/action_mailer/mail_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/mail_helper.rb b/actionmailer/lib/action_mailer/mail_helper.rb index 8d6e082d02..54ad9f066f 100644 --- a/actionmailer/lib/action_mailer/mail_helper.rb +++ b/actionmailer/lib/action_mailer/mail_helper.rb @@ -50,7 +50,7 @@ module ActionMailer end indentation = " " * indent - sentences.map { |sentence| + sentences.map! { |sentence| "#{indentation}#{sentence.join(' ')}" }.join "\n" end -- cgit v1.2.3 From 7e893717aa45b9c9653df60b0b312e2b5c619499 Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Fri, 2 Aug 2013 14:34:15 -0400 Subject: As we are doing debug mode on we don't need to silenced it --- actionmailer/test/abstract_unit.rb | 2 -- 1 file changed, 2 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb index 15729bafba..ed8cf72cd0 100644 --- a/actionmailer/test/abstract_unit.rb +++ b/actionmailer/test/abstract_unit.rb @@ -59,5 +59,3 @@ end def restore_delivery_method ActionMailer::Base.delivery_method = @old_delivery_method end - -ActiveSupport::Deprecation.silenced = true -- cgit v1.2.3 From ec8ef1e1055c4e1598da13f49d30261f07f4a9b4 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sat, 17 Aug 2013 21:38:53 +0530 Subject: Revert "Merge branch 'master' of github.com:rails/docrails" This reverts commit 70d6e16fbad75b89dd1798ed697e7732b8606fa3, reversing changes made to ea4db3bc078fb3093ecdddffdf4f2f4ff3e1e8f9. Seems to be a code merge done by mistake. --- actionmailer/lib/action_mailer/delivery_methods.rb | 2 +- actionmailer/test/delivery_methods_test.rb | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/delivery_methods.rb b/actionmailer/lib/action_mailer/delivery_methods.rb index aedcd81e52..9a1a27c8ed 100644 --- a/actionmailer/lib/action_mailer/delivery_methods.rb +++ b/actionmailer/lib/action_mailer/delivery_methods.rb @@ -64,7 +64,7 @@ module ActionMailer raise "Delivery method cannot be nil" when Symbol if klass = delivery_methods[method] - mail.delivery_method(klass, (send(:"#{method}_settings") || {}).merge(options || {})) + mail.delivery_method(klass,(send(:"#{method}_settings") || {}).merge!(options || {})) else raise "Invalid delivery method #{method.inspect}" end diff --git a/actionmailer/test/delivery_methods_test.rb b/actionmailer/test/delivery_methods_test.rb index 20412c7bb2..61a037ea18 100644 --- a/actionmailer/test/delivery_methods_test.rb +++ b/actionmailer/test/delivery_methods_test.rb @@ -152,9 +152,6 @@ class MailDeliveryTest < ActiveSupport::TestCase assert_equal "overridden", delivery_method_instance.settings[:user_name] assert_equal "somethingobtuse", delivery_method_instance.settings[:password] assert_equal delivery_method_instance.settings.merge(overridden_options), delivery_method_instance.settings - - # make sure that overriding delivery method options per mail instance doesn't affect the Base setting - assert_equal settings, ActionMailer::Base.smtp_settings end test "non registered delivery methods raises errors" do -- cgit v1.2.3 From 8e5a7243a1d408476e89a0fe4fd50bfde732e9ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Strza=C5=82kowski?= Date: Thu, 27 Jun 2013 14:45:29 +0200 Subject: Integrate ActionMailer with ActionView --- actionmailer/actionmailer.gemspec | 1 + actionmailer/lib/action_mailer/base.rb | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/actionmailer.gemspec b/actionmailer/actionmailer.gemspec index c56b6979ef..9b25feaf75 100644 --- a/actionmailer/actionmailer.gemspec +++ b/actionmailer/actionmailer.gemspec @@ -20,6 +20,7 @@ Gem::Specification.new do |s| s.requirements << 'none' s.add_dependency 'actionpack', version + s.add_dependency 'actionview', version s.add_dependency 'mail', '~> 2.5.4' end diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index cc3a412221..0928d3a639 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -1,4 +1,5 @@ require 'mail' +require 'action_view/base' require 'action_mailer/collector' require 'active_support/core_ext/string/inflections' require 'active_support/core_ext/hash/except' @@ -361,11 +362,13 @@ module ActionMailer # delivery_method :test. Most useful for unit and functional testing. class Base < AbstractController::Base include DeliveryMethods + abstract! + include ActionView::Rendering + include ActionView::Layouts + include AbstractController::Logger - include AbstractController::Rendering - include AbstractController::Layouts include AbstractController::Helpers include AbstractController::Translation include AbstractController::AssetPaths -- cgit v1.2.3 From 75d38e4364a292d8fddb89ff9959c88ab00ad7e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Strza=C5=82kowski?= Date: Thu, 27 Jun 2013 14:47:52 +0200 Subject: Do not include AV::Rendering It's already included in Layouts, makes no sense to doubly include it --- actionmailer/lib/action_mailer/base.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 0928d3a639..af4f3cf94b 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -365,7 +365,6 @@ module ActionMailer abstract! - include ActionView::Rendering include ActionView::Layouts include AbstractController::Logger -- cgit v1.2.3 From 3419ac26e97e38c6356c29672f5054ad072c01af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Strza=C5=82kowski?= Date: Thu, 11 Jul 2013 14:15:52 +0200 Subject: Include AbsC::Rendering interface in ActionMailer --- actionmailer/lib/action_mailer/base.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index af4f3cf94b..9f3dbe794a 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -4,6 +4,7 @@ require 'action_mailer/collector' require 'active_support/core_ext/string/inflections' require 'active_support/core_ext/hash/except' require 'active_support/core_ext/module/anonymous' + require 'action_mailer/log_subscriber' module ActionMailer @@ -365,6 +366,8 @@ module ActionMailer abstract! + include AbstractController::Rendering + include ActionView::Layouts include AbstractController::Logger -- cgit v1.2.3 From 2a25c4ce6da6ea23ebdf44e7eb2d2441dbea20a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Strza=C5=82kowski?= Date: Wed, 17 Jul 2013 15:08:10 +0200 Subject: Do not silance mail gem warnings. I doesn't have any at the moment --- actionmailer/test/abstract_unit.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb index ed8cf72cd0..bfa1302d79 100644 --- a/actionmailer/test/abstract_unit.rb +++ b/actionmailer/test/abstract_unit.rb @@ -11,11 +11,7 @@ end require 'active_support/testing/autorun' require 'action_mailer' require 'action_mailer/test_case' - -silence_warnings do - # These external dependencies have warnings :/ - require 'mail' -end +require 'mail' # Show backtraces for deprecated behavior for quicker cleanup. ActiveSupport::Deprecation.debug = true -- cgit v1.2.3 From d1760253f5a5c26b8b1d0f38f4f288d759fbb306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Strza=C5=82kowski?= Date: Wed, 17 Jul 2013 15:13:16 +0200 Subject: Load AV::Layout to AM::Base in railties --- actionmailer/lib/action_mailer/base.rb | 2 -- actionmailer/test/abstract_unit.rb | 3 +++ actionmailer/test/i18n_with_controller_test.rb | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 9f3dbe794a..fba2e00166 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -368,8 +368,6 @@ module ActionMailer include AbstractController::Rendering - include ActionView::Layouts - include AbstractController::Logger include AbstractController::Helpers include AbstractController::Translation diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb index bfa1302d79..1890853952 100644 --- a/actionmailer/test/abstract_unit.rb +++ b/actionmailer/test/abstract_unit.rb @@ -13,6 +13,9 @@ require 'action_mailer' require 'action_mailer/test_case' require 'mail' +# Emulate AV railtie +ActionMailer::Base.send(:include, ActionView::Layouts) + # Show backtraces for deprecated behavior for quicker cleanup. ActiveSupport::Deprecation.debug = true diff --git a/actionmailer/test/i18n_with_controller_test.rb b/actionmailer/test/i18n_with_controller_test.rb index a3e93c9c31..ab5eaaa9d5 100644 --- a/actionmailer/test/i18n_with_controller_test.rb +++ b/actionmailer/test/i18n_with_controller_test.rb @@ -1,4 +1,5 @@ require 'abstract_unit' +require 'action_view' require 'action_controller' class I18nTestMailer < ActionMailer::Base @@ -14,6 +15,9 @@ class I18nTestMailer < ActionMailer::Base end end +# Emulate AV railtie +ActionController::Base.superclass.send(:include, ActionView::Layouts) + class TestController < ActionController::Base def send_mail I18nTestMailer.mail_with_i18n_subject("test@localhost").deliver -- cgit v1.2.3 From e29c1b3103cd70c5448c8113a58798a8a924f510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Strza=C5=82kowski?= Date: Thu, 25 Jul 2013 16:43:13 +0200 Subject: Remove dependency on AV --- actionmailer/actionmailer.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionmailer') diff --git a/actionmailer/actionmailer.gemspec b/actionmailer/actionmailer.gemspec index 9b25feaf75..9ee8121d24 100644 --- a/actionmailer/actionmailer.gemspec +++ b/actionmailer/actionmailer.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |s| s.requirements << 'none' s.add_dependency 'actionpack', version - s.add_dependency 'actionview', version + s.add_development_dependency 'actionview', version s.add_dependency 'mail', '~> 2.5.4' end -- cgit v1.2.3 From 9e6a1439d1a0ad7f7098f1eca0bb8f6fa9482c48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Strza=C5=82kowski?= Date: Tue, 30 Jul 2013 00:26:24 +0200 Subject: Require log_subscriber --- actionmailer/lib/action_mailer/log_subscriber.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/log_subscriber.rb b/actionmailer/lib/action_mailer/log_subscriber.rb index c108156792..8467d45986 100644 --- a/actionmailer/lib/action_mailer/log_subscriber.rb +++ b/actionmailer/lib/action_mailer/log_subscriber.rb @@ -1,3 +1,5 @@ +require 'active_support/log_subscriber' + module ActionMailer # Implements the ActiveSupport::LogSubscriber for logging notifications when # email is delivered and received. -- cgit v1.2.3 From e868441896b17ec1ae1a3b7640ff8b302c31a983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Strza=C5=82kowski?= Date: Tue, 30 Jul 2013 00:50:24 +0200 Subject: Remove hard require to ActionView from ActionMailer --- actionmailer/lib/action_mailer.rb | 1 - actionmailer/lib/action_mailer/base.rb | 1 - actionmailer/test/abstract_unit.rb | 1 + 3 files changed, 1 insertion(+), 2 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb index c45124be80..5b6960c8fc 100644 --- a/actionmailer/lib/action_mailer.rb +++ b/actionmailer/lib/action_mailer.rb @@ -22,7 +22,6 @@ #++ require 'abstract_controller' -require 'action_view' require 'action_mailer/version' # Common Active Support usage in Action Mailer diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index fba2e00166..ada86fbc4f 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -1,5 +1,4 @@ require 'mail' -require 'action_view/base' require 'action_mailer/collector' require 'active_support/core_ext/string/inflections' require 'active_support/core_ext/hash/except' diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb index 1890853952..aa18c512c7 100644 --- a/actionmailer/test/abstract_unit.rb +++ b/actionmailer/test/abstract_unit.rb @@ -14,6 +14,7 @@ require 'action_mailer/test_case' require 'mail' # Emulate AV railtie +require 'action_view' ActionMailer::Base.send(:include, ActionView::Layouts) # Show backtraces for deprecated behavior for quicker cleanup. -- cgit v1.2.3 From 0d43df7ebf7587f032e3b16c153bf35746878c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Strza=C5=82kowski?= Date: Mon, 26 Aug 2013 10:54:38 +0200 Subject: Make AV dependency for ActionMailer --- actionmailer/actionmailer.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionmailer') diff --git a/actionmailer/actionmailer.gemspec b/actionmailer/actionmailer.gemspec index 9ee8121d24..9b25feaf75 100644 --- a/actionmailer/actionmailer.gemspec +++ b/actionmailer/actionmailer.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |s| s.requirements << 'none' s.add_dependency 'actionpack', version - s.add_development_dependency 'actionview', version + s.add_dependency 'actionview', version s.add_dependency 'mail', '~> 2.5.4' end -- cgit v1.2.3 From 7de994fa215e9f4c2856d85034bc4dd7b65d0c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Strza=C5=82kowski?= Date: Wed, 28 Aug 2013 23:43:33 +0200 Subject: Port all remaining self.protected_instance_variables to class methods --- actionmailer/lib/action_mailer/base.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index ada86fbc4f..9dcd4bf554 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -373,8 +373,6 @@ module ActionMailer include AbstractController::AssetPaths include AbstractController::Callbacks - self.protected_instance_variables = [:@_action_has_layout] - helper ActionMailer::MailHelper private_class_method :new #:nodoc: @@ -387,6 +385,10 @@ module ActionMailer parts_order: [ "text/plain", "text/enriched", "text/html" ] }.freeze + def self.default_protected_instance_vars + super.concat [:@_action_has_layout] + end + class << self # Register one or more Observers which will be notified when mail is delivered. def register_observers(*observers) -- cgit v1.2.3 From 40fcb9e82220fe9a7a3b0b3aeee61f92f00942c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Strza=C5=82kowski?= Date: Mon, 2 Sep 2013 23:05:42 +0200 Subject: Revert "Port all remaining self.protected_instance_variables to class methods" This reverts commit 7de994fa215e9f4c2856d85034bc4dd7b65d0c01. --- actionmailer/lib/action_mailer/base.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 9dcd4bf554..ada86fbc4f 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -373,6 +373,8 @@ module ActionMailer include AbstractController::AssetPaths include AbstractController::Callbacks + self.protected_instance_variables = [:@_action_has_layout] + helper ActionMailer::MailHelper private_class_method :new #:nodoc: @@ -385,10 +387,6 @@ module ActionMailer parts_order: [ "text/plain", "text/enriched", "text/html" ] }.freeze - def self.default_protected_instance_vars - super.concat [:@_action_has_layout] - end - class << self # Register one or more Observers which will be notified when mail is delivered. def register_observers(*observers) -- cgit v1.2.3 From 0c93a48904bcededd6093138ed81f3c13ac5e63f Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Fri, 26 Jul 2013 04:00:56 +0900 Subject: Don't mutate the Base settings by merge!ing the given value --- actionmailer/lib/action_mailer/delivery_methods.rb | 2 +- actionmailer/test/delivery_methods_test.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/delivery_methods.rb b/actionmailer/lib/action_mailer/delivery_methods.rb index 9a1a27c8ed..aedcd81e52 100644 --- a/actionmailer/lib/action_mailer/delivery_methods.rb +++ b/actionmailer/lib/action_mailer/delivery_methods.rb @@ -64,7 +64,7 @@ module ActionMailer raise "Delivery method cannot be nil" when Symbol if klass = delivery_methods[method] - mail.delivery_method(klass,(send(:"#{method}_settings") || {}).merge!(options || {})) + mail.delivery_method(klass, (send(:"#{method}_settings") || {}).merge(options || {})) else raise "Invalid delivery method #{method.inspect}" end diff --git a/actionmailer/test/delivery_methods_test.rb b/actionmailer/test/delivery_methods_test.rb index 61a037ea18..20412c7bb2 100644 --- a/actionmailer/test/delivery_methods_test.rb +++ b/actionmailer/test/delivery_methods_test.rb @@ -152,6 +152,9 @@ class MailDeliveryTest < ActiveSupport::TestCase assert_equal "overridden", delivery_method_instance.settings[:user_name] assert_equal "somethingobtuse", delivery_method_instance.settings[:password] assert_equal delivery_method_instance.settings.merge(overridden_options), delivery_method_instance.settings + + # make sure that overriding delivery method options per mail instance doesn't affect the Base setting + assert_equal settings, ActionMailer::Base.smtp_settings end test "non registered delivery methods raises errors" do -- cgit v1.2.3 From e2c17ff3ec050733c9f5f660eaafd46733215996 Mon Sep 17 00:00:00 2001 From: Waynn Lue Date: Mon, 9 Sep 2013 15:46:12 -0700 Subject: [ci skip] 'previous version of Rails' is gramatically incorrect --- actionmailer/README.rdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionmailer') diff --git a/actionmailer/README.rdoc b/actionmailer/README.rdoc index a14a6ba18f..178572706c 100644 --- a/actionmailer/README.rdoc +++ b/actionmailer/README.rdoc @@ -61,7 +61,7 @@ generated would look like this: Thank you for signing up! -In previous version of Rails you would call create_method_name and +In previous versions of Rails you would call create_method_name and deliver_method_name. Rails 3.0 has a much simpler interface - you simply call the method and optionally call +deliver+ on the return value. -- cgit v1.2.3 From d17333d10c9dde426a741dc4cd7493ced01e5526 Mon Sep 17 00:00:00 2001 From: claudiob Date: Thu, 12 Sep 2013 01:08:10 -0700 Subject: Remove unused raw email fixtures The tests that used the raw_email_* fixtures were removed in d500ad3 --- actionmailer/test/fixtures/raw_email10 | 20 ---- actionmailer/test/fixtures/raw_email12 | 32 ------ actionmailer/test/fixtures/raw_email13 | 29 ------ actionmailer/test/fixtures/raw_email2 | 114 --------------------- actionmailer/test/fixtures/raw_email3 | 70 ------------- actionmailer/test/fixtures/raw_email4 | 59 ----------- actionmailer/test/fixtures/raw_email5 | 19 ---- actionmailer/test/fixtures/raw_email6 | 20 ---- actionmailer/test/fixtures/raw_email7 | 66 ------------ actionmailer/test/fixtures/raw_email8 | 47 --------- actionmailer/test/fixtures/raw_email9 | 28 ----- .../test/fixtures/raw_email_quoted_with_0d0a | 14 --- ...w_email_with_invalid_characters_in_content_type | 104 ------------------- .../test/fixtures/raw_email_with_nested_attachment | 100 ------------------ .../raw_email_with_partially_quoted_subject | 14 --- 15 files changed, 736 deletions(-) delete mode 100644 actionmailer/test/fixtures/raw_email10 delete mode 100644 actionmailer/test/fixtures/raw_email12 delete mode 100644 actionmailer/test/fixtures/raw_email13 delete mode 100644 actionmailer/test/fixtures/raw_email2 delete mode 100644 actionmailer/test/fixtures/raw_email3 delete mode 100644 actionmailer/test/fixtures/raw_email4 delete mode 100644 actionmailer/test/fixtures/raw_email5 delete mode 100644 actionmailer/test/fixtures/raw_email6 delete mode 100644 actionmailer/test/fixtures/raw_email7 delete mode 100644 actionmailer/test/fixtures/raw_email8 delete mode 100644 actionmailer/test/fixtures/raw_email9 delete mode 100644 actionmailer/test/fixtures/raw_email_quoted_with_0d0a delete mode 100644 actionmailer/test/fixtures/raw_email_with_invalid_characters_in_content_type delete mode 100644 actionmailer/test/fixtures/raw_email_with_nested_attachment delete mode 100644 actionmailer/test/fixtures/raw_email_with_partially_quoted_subject (limited to 'actionmailer') diff --git a/actionmailer/test/fixtures/raw_email10 b/actionmailer/test/fixtures/raw_email10 deleted file mode 100644 index edad5ccff1..0000000000 --- a/actionmailer/test/fixtures/raw_email10 +++ /dev/null @@ -1,20 +0,0 @@ -Return-Path: -Received: from xxx.xxxx.xxx by xxx.xxxx.xxx with ESMTP id C1B953B4CB6 for ; Tue, 10 May 2005 15:27:05 -0500 -Received: from SMS-GTYxxx.xxxx.xxx by xxx.xxxx.xxx with ESMTP id ca for ; Tue, 10 May 2005 15:27:04 -0500 -Received: from xxx.xxxx.xxx by SMS-GTYxxx.xxxx.xxx with ESMTP id j4AKR3r23323 for ; Tue, 10 May 2005 15:27:03 -0500 -Date: Tue, 10 May 2005 15:27:03 -0500 -From: xxx@xxxx.xxx -Sender: xxx@xxxx.xxx -To: xxxxxxxxxxx@xxxx.xxxx.xxx -Message-Id: -X-Original-To: xxxxxxxxxxx@xxxx.xxxx.xxx -Delivered-To: xxx@xxxx.xxx -Importance: normal -Content-Type: text/plain; charset=X-UNKNOWN - -Test test. Hi. Waving. m - ----------------------------------------------------------------- -Sent via Bell Mobility's Text Messaging service. -Envoyé par le service de messagerie texte de Bell Mobilité. ----------------------------------------------------------------- diff --git a/actionmailer/test/fixtures/raw_email12 b/actionmailer/test/fixtures/raw_email12 deleted file mode 100644 index 2cd31720d3..0000000000 --- a/actionmailer/test/fixtures/raw_email12 +++ /dev/null @@ -1,32 +0,0 @@ -Mime-Version: 1.0 (Apple Message framework v730) -Content-Type: multipart/mixed; boundary=Apple-Mail-13-196941151 -Message-Id: <9169D984-4E0B-45EF-82D4-8F5E53AD7012@example.com> -From: foo@example.com -Subject: testing -Date: Mon, 6 Jun 2005 22:21:22 +0200 -To: blah@example.com - - ---Apple-Mail-13-196941151 -Content-Transfer-Encoding: quoted-printable -Content-Type: text/plain; - charset=ISO-8859-1; - delsp=yes; - format=flowed - -This is the first part. - ---Apple-Mail-13-196941151 -Content-Type: image/jpeg -Content-Transfer-Encoding: base64 -Content-Location: Photo25.jpg -Content-ID: -Content-Disposition: inline - -jamisSqGSIb3DQEHAqCAMIjamisxCzAJBgUrDgMCGgUAMIAGCSqGSjamisEHAQAAoIIFSjCCBUYw -ggQujamisQICBD++ukQwDQYJKojamisNAQEFBQAwMTELMAkGA1UEBhMCRjamisAKBgNVBAoTA1RE -QzEUMBIGjamisxMLVERDIE9DRVMgQ0jamisNMDQwMjI5MTE1OTAxWhcNMDYwMjamisIyOTAxWjCB -gDELMAkGA1UEjamisEsxKTAnBgNVBAoTIEjamisuIG9yZ2FuaXNhdG9yaXNrIHRpbjamisRuaW5= - ---Apple-Mail-13-196941151-- - diff --git a/actionmailer/test/fixtures/raw_email13 b/actionmailer/test/fixtures/raw_email13 deleted file mode 100644 index 7d9314e36a..0000000000 --- a/actionmailer/test/fixtures/raw_email13 +++ /dev/null @@ -1,29 +0,0 @@ -Mime-Version: 1.0 (Apple Message framework v730) -Content-Type: multipart/mixed; boundary=Apple-Mail-13-196941151 -Message-Id: <9169D984-4E0B-45EF-82D4-8F5E53AD7012@example.com> -From: foo@example.com -Subject: testing -Date: Mon, 6 Jun 2005 22:21:22 +0200 -To: blah@example.com - - ---Apple-Mail-13-196941151 -Content-Transfer-Encoding: quoted-printable -Content-Type: text/plain; - charset=ISO-8859-1; - delsp=yes; - format=flowed - -This is the first part. - ---Apple-Mail-13-196941151 -Content-Type: text/x-ruby-script; name="hello.rb" -Content-Transfer-Encoding: 7bit -Content-Disposition: attachment; - filename="api.rb" - -puts "Hello, world!" -gets - ---Apple-Mail-13-196941151-- - diff --git a/actionmailer/test/fixtures/raw_email2 b/actionmailer/test/fixtures/raw_email2 deleted file mode 100644 index 9f87bb2a98..0000000000 --- a/actionmailer/test/fixtures/raw_email2 +++ /dev/null @@ -1,114 +0,0 @@ -From xxxxxxxxx.xxxxxxx@gmail.com Sun May 8 19:07:09 2005 -Return-Path: -X-Original-To: xxxxx@xxxxx.xxxxxxxxx.com -Delivered-To: xxxxx@xxxxx.xxxxxxxxx.com -Received: from localhost (localhost [127.0.0.1]) - by xxxxx.xxxxxxxxx.com (Postfix) with ESMTP id 06C9DA98D - for ; Sun, 8 May 2005 19:09:13 +0000 (GMT) -Received: from xxxxx.xxxxxxxxx.com ([127.0.0.1]) - by localhost (xxxxx.xxxxxxxxx.com [127.0.0.1]) (amavisd-new, port 10024) - with LMTP id 88783-08 for ; - Sun, 8 May 2005 19:09:12 +0000 (GMT) -Received: from xxxxxxx.xxxxxxxxx.com (xxxxxxx.xxxxxxxxx.com [69.36.39.150]) - by xxxxx.xxxxxxxxx.com (Postfix) with ESMTP id 10D8BA960 - for ; Sun, 8 May 2005 19:09:12 +0000 (GMT) -Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.199]) - by xxxxxxx.xxxxxxxxx.com (Postfix) with ESMTP id 9EBC4148EAB - for ; Sun, 8 May 2005 14:09:11 -0500 (CDT) -Received: by zproxy.gmail.com with SMTP id 13so1233405nzp - for ; Sun, 08 May 2005 12:09:11 -0700 (PDT) -DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; - s=beta; d=gmail.com; - h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:references; - b=cid1mzGEFa3gtRa06oSrrEYfKca2CTKu9sLMkWxjbvCsWMtp9RGEILjUz0L5RySdH5iO661LyNUoHRFQIa57bylAbXM3g2DTEIIKmuASDG3x3rIQ4sHAKpNxP7Pul+mgTaOKBv+spcH7af++QEJ36gHFXD2O/kx9RePs3JNf/K8= -Received: by 10.36.10.16 with SMTP id 16mr1012493nzj; - Sun, 08 May 2005 12:09:11 -0700 (PDT) -Received: by 10.36.5.10 with HTTP; Sun, 8 May 2005 12:09:11 -0700 (PDT) -Message-ID: -Date: Sun, 8 May 2005 14:09:11 -0500 -From: xxxxxxxxx xxxxxxx -Reply-To: xxxxxxxxx xxxxxxx -To: xxxxx xxxx -Subject: Fwd: Signed email causes file attachments -In-Reply-To: -Mime-Version: 1.0 -Content-Type: multipart/mixed; - boundary="----=_Part_5028_7368284.1115579351471" -References: - -------=_Part_5028_7368284.1115579351471 -Content-Type: text/plain; charset=ISO-8859-1 -Content-Transfer-Encoding: quoted-printable -Content-Disposition: inline - -We should not include these files or vcards as attachments. - ----------- Forwarded message ---------- -From: xxxxx xxxxxx -Date: May 8, 2005 1:17 PM -Subject: Signed email causes file attachments -To: xxxxxxx@xxxxxxxxxx.com - - -Hi, - -Just started to use my xxxxxxxx account (to set-up a GTD system, -natch) and noticed that when I send content via email the signature/ -certificate from my email account gets added as a file (e.g. -"smime.p7s"). - -Obviously I can uncheck the signature option in the Mail compose -window but how often will I remember to do that? - -Is there any way these kind of files could be ignored, e.g. via some -sort of exclusions list? - -------=_Part_5028_7368284.1115579351471 -Content-Type: application/pkcs7-signature; name=smime.p7s -Content-Transfer-Encoding: base64 -Content-Disposition: attachment; filename="smime.p7s" - -MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGFDCCAs0w -ggI2oAMCAQICAw5c+TANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh -d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt -YWlsIElzc3VpbmcgQ0EwHhcNMDUwMzI5MDkzOTEwWhcNMDYwMzI5MDkzOTEwWjBCMR8wHQYDVQQD -ExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMR8wHQYJKoZIhvcNAQkBFhBzbWhhdW5jaEBtYWMuY29t -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAn90dPsYS3LjfMY211OSYrDQLzwNYPlAL -7+/0XA+kdy8/rRnyEHFGwhNCDmg0B6pxC7z3xxJD/8GfCd+IYUUNUQV5m9MkxfP9pTVXZVIYLaBw -o8xS3A0a1LXealcmlEbJibmKkEaoXci3MhryLgpaa+Kk/sH02SNatDO1vS28bPsibZpcc6deFrla -hSYnL+PW54mDTGHIcCN2fbx/Y6qspzqmtKaXrv75NBtuy9cB6KzU4j2xXbTkAwz3pRSghJJaAwdp -+yIivAD3vr0kJE3p+Ez34HMh33EXEpFoWcN+MCEQZD9WnmFViMrvfvMXLGVFQfAAcC060eGFSRJ1 -ZQ9UVQIDAQABoy0wKzAbBgNVHREEFDASgRBzbWhhdW5jaEBtYWMuY29tMAwGA1UdEwEB/wQCMAAw -DQYJKoZIhvcNAQEEBQADgYEAQMrg1n2pXVWteP7BBj+Pk3UfYtbuHb42uHcLJjfjnRlH7AxnSwrd -L3HED205w3Cq8T7tzVxIjRRLO/ljq0GedSCFBky7eYo1PrXhztGHCTSBhsiWdiyLWxKlOxGAwJc/ -lMMnwqLOdrQcoF/YgbjeaUFOQbUh94w9VDNpWZYCZwcwggM/MIICqKADAgECAgENMA0GCSqGSIb3 -DQEBBQUAMIHRMQswCQYDVQQGEwJaQTEVMBMGA1UECBMMV2VzdGVybiBDYXBlMRIwEAYDVQQHEwlD -YXBlIFRvd24xGjAYBgNVBAoTEVRoYXd0ZSBDb25zdWx0aW5nMSgwJgYDVQQLEx9DZXJ0aWZpY2F0 -aW9uIFNlcnZpY2VzIERpdmlzaW9uMSQwIgYDVQQDExtUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwg -Q0ExKzApBgkqhkiG9w0BCQEWHHBlcnNvbmFsLWZyZWVtYWlsQHRoYXd0ZS5jb20wHhcNMDMwNzE3 -MDAwMDAwWhcNMTMwNzE2MjM1OTU5WjBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENv -bnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElz -c3VpbmcgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMSmPFVzVftOucqZWh5owHUEcJ3f -6f+jHuy9zfVb8hp2vX8MOmHyv1HOAdTlUAow1wJjWiyJFXCO3cnwK4Vaqj9xVsuvPAsH5/EfkTYk -KhPPK9Xzgnc9A74r/rsYPge/QIACZNenprufZdHFKlSFD0gEf6e20TxhBEAeZBlyYLf7AgMBAAGj -gZQwgZEwEgYDVR0TAQH/BAgwBgEB/wIBADBDBgNVHR8EPDA6MDigNqA0hjJodHRwOi8vY3JsLnRo -YXd0ZS5jb20vVGhhd3RlUGVyc29uYWxGcmVlbWFpbENBLmNybDALBgNVHQ8EBAMCAQYwKQYDVR0R -BCIwIKQeMBwxGjAYBgNVBAMTEVByaXZhdGVMYWJlbDItMTM4MA0GCSqGSIb3DQEBBQUAA4GBAEiM -0VCD6gsuzA2jZqxnD3+vrL7CF6FDlpSdf0whuPg2H6otnzYvwPQcUCCTcDz9reFhYsPZOhl+hLGZ -GwDFGguCdJ4lUJRix9sncVcljd2pnDmOjCBPZV+V2vf3h9bGCE6u9uo05RAaWzVNd+NWIXiC3CEZ -Nd4ksdMdRv9dX2VPMYIC5zCCAuMCAQEwaTBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3Rl -IENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWls -IElzc3VpbmcgQ0ECAw5c+TAJBgUrDgMCGgUAoIIBUzAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcB -MBwGCSqGSIb3DQEJBTEPFw0wNTA1MDgxODE3NDZaMCMGCSqGSIb3DQEJBDEWBBQSkG9j6+hB0pKp -fV9tCi/iP59sNTB4BgkrBgEEAYI3EAQxazBpMGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3 -dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1h -aWwgSXNzdWluZyBDQQIDDlz5MHoGCyqGSIb3DQEJEAILMWugaTBiMQswCQYDVQQGEwJaQTElMCMG -A1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNv -bmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECAw5c+TANBgkqhkiG9w0BAQEFAASCAQAm1GeF7dWfMvrW -8yMPjkhE+R8D1DsiCoWSCp+5gAQm7lcK7V3KrZh5howfpI3TmCZUbbaMxOH+7aKRKpFemxoBY5Q8 -rnCkbpg/++/+MI01T69hF/rgMmrGcrv2fIYy8EaARLG0xUVFSZHSP+NQSYz0TTmh4cAESHMzY3JA -nHOoUkuPyl8RXrimY1zn0lceMXlweZRouiPGuPNl1hQKw8P+GhOC5oLlM71UtStnrlk3P9gqX5v7 -Tj7Hx057oVfY8FMevjxGwU3EK5TczHezHbWWgTyum9l2ZQbUQsDJxSniD3BM46C1VcbDLPaotAZ0 -fTYLZizQfm5hcWEbfYVzkSzLAAAAAAAA -------=_Part_5028_7368284.1115579351471-- - diff --git a/actionmailer/test/fixtures/raw_email3 b/actionmailer/test/fixtures/raw_email3 deleted file mode 100644 index 3a0927490a..0000000000 --- a/actionmailer/test/fixtures/raw_email3 +++ /dev/null @@ -1,70 +0,0 @@ -From xxxx@xxxx.com Tue May 10 11:28:07 2005 -Return-Path: -X-Original-To: xxxx@xxxx.com -Delivered-To: xxxx@xxxx.com -Received: from localhost (localhost [127.0.0.1]) - by xxx.xxxxx.com (Postfix) with ESMTP id 50FD3A96F - for ; Tue, 10 May 2005 17:26:50 +0000 (GMT) -Received: from xxx.xxxxx.com ([127.0.0.1]) - by localhost (xxx.xxxxx.com [127.0.0.1]) (amavisd-new, port 10024) - with LMTP id 70060-03 for ; - Tue, 10 May 2005 17:26:49 +0000 (GMT) -Received: from xxx.xxxxx.com (xxx.xxxxx.com [69.36.39.150]) - by xxx.xxxxx.com (Postfix) with ESMTP id 8B957A94B - for ; Tue, 10 May 2005 17:26:48 +0000 (GMT) -Received: from xxx.xxxxx.com (xxx.xxxxx.com [64.233.184.203]) - by xxx.xxxxx.com (Postfix) with ESMTP id 9972514824C - for ; Tue, 10 May 2005 12:26:40 -0500 (CDT) -Received: by xxx.xxxxx.com with SMTP id 68so1694448wri - for ; Tue, 10 May 2005 10:26:40 -0700 (PDT) -DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; - s=beta; d=xxxxx.com; - h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type; - b=g8ZO5ttS6GPEMAz9WxrRk9+9IXBUfQIYsZLL6T88+ECbsXqGIgfGtzJJFn6o9CE3/HMrrIGkN5AisxVFTGXWxWci5YA/7PTVWwPOhJff5BRYQDVNgRKqMl/SMttNrrRElsGJjnD1UyQ/5kQmcBxq2PuZI5Zc47u6CILcuoBcM+A= -Received: by 10.54.96.19 with SMTP id t19mr621017wrb; - Tue, 10 May 2005 10:26:39 -0700 (PDT) -Received: by 10.54.110.5 with HTTP; Tue, 10 May 2005 10:26:39 -0700 (PDT) -Message-ID: -Date: Tue, 10 May 2005 11:26:39 -0600 -From: Test Tester -Reply-To: Test Tester -To: xxxx@xxxx.com, xxxx@xxxx.com -Subject: Another PDF -Mime-Version: 1.0 -Content-Type: multipart/mixed; - boundary="----=_Part_2192_32400445.1115745999735" -X-Virus-Scanned: amavisd-new at textdrive.com - -------=_Part_2192_32400445.1115745999735 -Content-Type: text/plain; charset=ISO-8859-1 -Content-Transfer-Encoding: quoted-printable -Content-Disposition: inline - -Just attaching another PDF, here, to see what the message looks like, -and to see if I can figure out what is going wrong here. - -------=_Part_2192_32400445.1115745999735 -Content-Type: application/pdf; name="broken.pdf" -Content-Transfer-Encoding: base64 -Content-Disposition: attachment; filename="broken.pdf" - -JVBERi0xLjQNCiXk9tzfDQoxIDAgb2JqDQo8PCAvTGVuZ3RoIDIgMCBSDQogICAvRmlsdGVyIC9G -bGF0ZURlY29kZQ0KPj4NCnN0cmVhbQ0KeJy9Wt2KJbkNvm/od6jrhZxYln9hWEh2p+8HBvICySaE -ycLuTV4/1ifJ9qnq09NpSBimu76yLUuy/qzqcPz7+em3Ixx/CDc6CsXxs3b5+fvfjr/8cPz6/BRu -rbfAx/n3739/fuJylJ5u5fjX81OuDr4deK4Bz3z/aDP+8fz0yw8g0Ofq7ktr1Mn+u28rvhy/jVeD -QSa+9YNKHP/pxjvDNfVAx/m3MFz54FhvTbaseaxiDoN2LeMVMw+yA7RbHSCDzxZuaYB2E1Yay7QU -x89vz0+tyFDKMlAHK5yqLmnjF+c4RjEiQIUeKwblXMe+AsZjN1J5yGQL5DHpDHksurM81rF6PKab -gK6zAarIDzIiUY23rJsN9iorAE816aIu6lsgAdQFsuhhkHOUFgVjp2GjMqSewITXNQ27jrMeamkg -1rPI3iLWG2CIaSBB+V1245YVRICGbbpYKHc2USFDl6M09acQVQYhlwIrkBNLISvXhGlF1wi5FHCw -wxZkoGNJlVeJCEsqKA+3YAV5AMb6KkeaqEJQmFKKQU8T1pRi2ihE1Y4CDrqoYFFXYjJJOatsyzuI -8SIlykuxKTMibWK8H1PgEvqYgs4GmQSrEjJAalgGirIhik+p4ZQN9E3ETFPAHE1b8pp1l/0Rc1gl -fQs0ABWvyoZZzU8VnPXwVVcO9BEsyjEJaO6eBoZRyKGlrKoYoOygA8BGIzgwN3RQ15ouigG5idZQ -fx2U4Db2CqiLO0WHAZoylGiCAqhniNQjFjQPSkmjwfNTgQ6M1Ih+eWo36wFmjIxDJZiGUBiWsAyR -xX3EekGOizkGI96Ol9zVZTAivikURhRsHh2E3JhWMpSTZCnnonrLhMCodgrNcgo4uyJUJc6qnVss -nrGd1Ptr0YwisCOYyIbUwVjV4xBUNLbguSO2YHujonAMJkMdSI7bIw91Akq2AUlMUWGFTMAOamjU -OvZQCxIkY2pCpMFo/IwLdVLHs6nddwTRrgoVbvLU9eB0G4EMndV0TNoxHbt3JBWwK6hhv3iHfDtF -yokB302IpEBTnWICde4uYc/1khDbSIkQopO6lcqamGBu1OSE3N5IPSsZX00CkSHRiiyx6HQIShsS -HSVNswdVsaOUSAWq9aYhDtGDaoG5a3lBGkYt/lFlBFt1UqrYnzVtUpUQnLiZeouKgf1KhRBViRRk -ExepJCzTwEmFDalIRbLEGtw0gfpESOpIAF/NnpPzcVCG86s0g2DuSyd41uhNGbEgaSrWEXORErbw -------=_Part_2192_32400445.1115745999735-- - diff --git a/actionmailer/test/fixtures/raw_email4 b/actionmailer/test/fixtures/raw_email4 deleted file mode 100644 index 639ad40e49..0000000000 --- a/actionmailer/test/fixtures/raw_email4 +++ /dev/null @@ -1,59 +0,0 @@ -Return-Path: -Received: from xxx.xxxx.xxx by xxx.xxxx.xxx with ESMTP id 6AAEE3B4D23 for ; Sun, 8 May 2005 12:30:23 -0500 -Received: from xxx.xxxx.xxx by xxx.xxxx.xxx with ESMTP id j48HUC213279 for ; Sun, 8 May 2005 12:30:13 -0500 -Received: from conversion-xxx.xxxx.xxx.net by xxx.xxxx.xxx id <0IG600901LQ64I@xxx.xxxx.xxx> for ; Sun, 8 May 2005 12:30:12 -0500 -Received: from agw1 by xxx.xxxx.xxx with ESMTP id <0IG600JFYLYCAxxx@xxxx.xxx> for ; Sun, 8 May 2005 12:30:12 -0500 -Date: Sun, 8 May 2005 12:30:08 -0500 -From: xxx@xxxx.xxx -To: xxx@xxxx.xxx -Message-Id: <7864245.1115573412626.JavaMxxx@xxxx.xxx> -Subject: Filth -Mime-Version: 1.0 -Content-Type: multipart/mixed; boundary=mimepart_427e4cb4ca329_133ae40413c81ef -X-Mms-Priority: 1 -X-Mms-Transaction-Id: 3198421808-0 -X-Mms-Message-Type: 0 -X-Mms-Sender-Visibility: 1 -X-Mms-Read-Reply: 1 -X-Original-To: xxx@xxxx.xxx -X-Mms-Message-Class: 0 -X-Mms-Delivery-Report: 0 -X-Mms-Mms-Version: 16 -Delivered-To: xxx@xxxx.xxx -X-Nokia-Ag-Version: 2.0 - -This is a multi-part message in MIME format. - ---mimepart_427e4cb4ca329_133ae40413c81ef -Content-Type: multipart/mixed; boundary=mimepart_427e4cb4cbd97_133ae40413c8217 - - - ---mimepart_427e4cb4cbd97_133ae40413c8217 -Content-Type: text/plain; charset=utf-8 -Content-Transfer-Encoding: 7bit -Content-Disposition: inline -Content-Location: text.txt - -Some text - ---mimepart_427e4cb4cbd97_133ae40413c8217-- - ---mimepart_427e4cb4ca329_133ae40413c81ef -Content-Type: text/plain; charset=us-ascii -Content-Transfer-Encoding: 7bit - - --- -This Orange Multi Media Message was sent wirefree from an Orange -MMS phone. If you would like to reply, please text or phone the -sender directly by using the phone number listed in the sender's -address. To learn more about Orange's Multi Media Messaging -Service, find us on the Web at xxx.xxxx.xxx.uk/mms - - ---mimepart_427e4cb4ca329_133ae40413c81ef - - ---mimepart_427e4cb4ca329_133ae40413c81ef- - diff --git a/actionmailer/test/fixtures/raw_email5 b/actionmailer/test/fixtures/raw_email5 deleted file mode 100644 index bbe31bcdc5..0000000000 --- a/actionmailer/test/fixtures/raw_email5 +++ /dev/null @@ -1,19 +0,0 @@ -Return-Path: -Received: from xxx.xxxx.xxx by xxx.xxxx.xxx with ESMTP id C1B953B4CB6 for ; Tue, 10 May 2005 15:27:05 -0500 -Received: from SMS-GTYxxx.xxxx.xxx by xxx.xxxx.xxx with ESMTP id ca for ; Tue, 10 May 2005 15:27:04 -0500 -Received: from xxx.xxxx.xxx by SMS-GTYxxx.xxxx.xxx with ESMTP id j4AKR3r23323 for ; Tue, 10 May 2005 15:27:03 -0500 -Date: Tue, 10 May 2005 15:27:03 -0500 -From: xxx@xxxx.xxx -Sender: xxx@xxxx.xxx -To: xxxxxxxxxxx@xxxx.xxxx.xxx -Message-Id: -X-Original-To: xxxxxxxxxxx@xxxx.xxxx.xxx -Delivered-To: xxx@xxxx.xxx -Importance: normal - -Test test. Hi. Waving. m - ----------------------------------------------------------------- -Sent via Bell Mobility's Text Messaging service. -Envoyé par le service de messagerie texte de Bell Mobilité. ----------------------------------------------------------------- diff --git a/actionmailer/test/fixtures/raw_email6 b/actionmailer/test/fixtures/raw_email6 deleted file mode 100644 index 8e37bd7392..0000000000 --- a/actionmailer/test/fixtures/raw_email6 +++ /dev/null @@ -1,20 +0,0 @@ -Return-Path: -Received: from xxx.xxxx.xxx by xxx.xxxx.xxx with ESMTP id C1B953B4CB6 for ; Tue, 10 May 2005 15:27:05 -0500 -Received: from SMS-GTYxxx.xxxx.xxx by xxx.xxxx.xxx with ESMTP id ca for ; Tue, 10 May 2005 15:27:04 -0500 -Received: from xxx.xxxx.xxx by SMS-GTYxxx.xxxx.xxx with ESMTP id j4AKR3r23323 for ; Tue, 10 May 2005 15:27:03 -0500 -Date: Tue, 10 May 2005 15:27:03 -0500 -From: xxx@xxxx.xxx -Sender: xxx@xxxx.xxx -To: xxxxxxxxxxx@xxxx.xxxx.xxx -Message-Id: -X-Original-To: xxxxxxxxxxx@xxxx.xxxx.xxx -Delivered-To: xxx@xxxx.xxx -Importance: normal -Content-Type: text/plain; charset=us-ascii - -Test test. Hi. Waving. m - ----------------------------------------------------------------- -Sent via Bell Mobility's Text Messaging service. -Envoyé par le service de messagerie texte de Bell Mobilité. ----------------------------------------------------------------- diff --git a/actionmailer/test/fixtures/raw_email7 b/actionmailer/test/fixtures/raw_email7 deleted file mode 100644 index da64ada8a5..0000000000 --- a/actionmailer/test/fixtures/raw_email7 +++ /dev/null @@ -1,66 +0,0 @@ -Mime-Version: 1.0 (Apple Message framework v730) -Content-Type: multipart/mixed; boundary=Apple-Mail-13-196941151 -Message-Id: <9169D984-4E0B-45EF-82D4-8F5E53AD7012@example.com> -From: foo@example.com -Subject: testing -Date: Mon, 6 Jun 2005 22:21:22 +0200 -To: blah@example.com - - ---Apple-Mail-13-196941151 -Content-Type: multipart/mixed; - boundary=Apple-Mail-12-196940926 - - ---Apple-Mail-12-196940926 -Content-Transfer-Encoding: quoted-printable -Content-Type: text/plain; - charset=ISO-8859-1; - delsp=yes; - format=flowed - -This is the first part. - ---Apple-Mail-12-196940926 -Content-Transfer-Encoding: 7bit -Content-Type: text/x-ruby-script; - x-unix-mode=0666; - name="test.rb" -Content-Disposition: attachment; - filename=test.rb - -puts "testing, testing" - ---Apple-Mail-12-196940926 -Content-Transfer-Encoding: base64 -Content-Type: application/pdf; - x-unix-mode=0666; - name="test.pdf" -Content-Disposition: inline; - filename=test.pdf - -YmxhaCBibGFoIGJsYWg= - ---Apple-Mail-12-196940926 -Content-Transfer-Encoding: 7bit -Content-Type: text/plain; - charset=US-ASCII; - format=flowed - - - ---Apple-Mail-12-196940926-- - ---Apple-Mail-13-196941151 -Content-Transfer-Encoding: base64 -Content-Type: application/pkcs7-signature; - name=smime.p7s -Content-Disposition: attachment; - filename=smime.p7s - -jamisSqGSIb3DQEHAqCAMIjamisxCzAJBgUrDgMCGgUAMIAGCSqGSjamisEHAQAAoIIFSjCCBUYw -ggQujamisQICBD++ukQwDQYJKojamisNAQEFBQAwMTELMAkGA1UEBhMCRjamisAKBgNVBAoTA1RE -QzEUMBIGjamisxMLVERDIE9DRVMgQ0jamisNMDQwMjI5MTE1OTAxWhcNMDYwMjamisIyOTAxWjCB -gDELMAkGA1UEjamisEsxKTAnBgNVBAoTIEjamisuIG9yZ2FuaXNhdG9yaXNrIHRpbjamisRuaW5= - ---Apple-Mail-13-196941151-- diff --git a/actionmailer/test/fixtures/raw_email8 b/actionmailer/test/fixtures/raw_email8 deleted file mode 100644 index 79996365b3..0000000000 --- a/actionmailer/test/fixtures/raw_email8 +++ /dev/null @@ -1,47 +0,0 @@ -From xxxxxxxxx.xxxxxxx@gmail.com Sun May 8 19:07:09 2005 -Return-Path: -Message-ID: -Date: Sun, 8 May 2005 14:09:11 -0500 -From: xxxxxxxxx xxxxxxx -Reply-To: xxxxxxxxx xxxxxxx -To: xxxxx xxxx -Subject: Fwd: Signed email causes file attachments -In-Reply-To: -Mime-Version: 1.0 -Content-Type: multipart/mixed; - boundary="----=_Part_5028_7368284.1115579351471" -References: - -------=_Part_5028_7368284.1115579351471 -Content-Type: text/plain; charset=ISO-8859-1 -Content-Transfer-Encoding: quoted-printable -Content-Disposition: inline - -We should not include these files or vcards as attachments. - ----------- Forwarded message ---------- -From: xxxxx xxxxxx -Date: May 8, 2005 1:17 PM -Subject: Signed email causes file attachments -To: xxxxxxx@xxxxxxxxxx.com - - -Hi, - -Test attachments oddly encoded with japanese charset. - - -------=_Part_5028_7368284.1115579351471 -Content-Type: application/octet-stream; name*=iso-2022-jp'ja'01%20Quien%20Te%20Dij%8aat.%20Pitbull.mp3 -Content-Transfer-Encoding: base64 -Content-Disposition: attachment - -MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGFDCCAs0w -ggI2oAMCAQICAw5c+TANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh -d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt -YWlsIElzc3VpbmcgQ0EwHhcNMDUwMzI5MDkzOTEwWhcNMDYwMzI5MDkzOTEwWjBCMR8wHQYDVQQD -ExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMR8wHQYJKoZIhvcNAQkBFhBzbWhhdW5jaEBtYWMuY29t -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAn90dPsYS3LjfMY211OSYrDQLzwNYPlAL -7+/0XA+kdy8/rRnyEHFGwhNCDmg0B6pxC7z3xxJD/8GfCd+IYUUNUQV5m9MkxfP9pTVXZVIYLaBw -------=_Part_5028_7368284.1115579351471-- - diff --git a/actionmailer/test/fixtures/raw_email9 b/actionmailer/test/fixtures/raw_email9 deleted file mode 100644 index 02ea0b05c5..0000000000 --- a/actionmailer/test/fixtures/raw_email9 +++ /dev/null @@ -1,28 +0,0 @@ -Received: from xxx.xxx.xxx ([xxx.xxx.xxx.xxx] verified) - by xxx.com (CommuniGate Pro SMTP 4.2.8) - with SMTP id 2532598 for xxx@xxx.com; Wed, 23 Feb 2005 17:51:49 -0500 -Received-SPF: softfail - receiver=xxx.com; client-ip=xxx.xxx.xxx.xxx; envelope-from=xxx@xxx.xxx -quite Delivered-To: xxx@xxx.xxx -Received: by xxx.xxx.xxx (Wostfix, from userid xxx) - id 0F87F333; Wed, 23 Feb 2005 16:16:17 -0600 -Date: Wed, 23 Feb 2005 18:20:17 -0400 -From: "xxx xxx" -Message-ID: <4D6AA7EB.6490534@xxx.xxx> -To: xxx@xxx.com -Subject: Stop adware/spyware once and for all. -X-Scanned-By: MIMEDefang 2.11 (www dot roaringpenguin dot com slash mimedefang) - -You are infected with: -Ad Ware and Spy Ware - -Get your free scan and removal download now, -before it gets any worse. - -http://xxx.xxx.info?aid=3D13&?stat=3D4327kdzt - - - - -no more? (you will still be infected) -http://xxx.xxx.info/discon/?xxx@xxx.com diff --git a/actionmailer/test/fixtures/raw_email_quoted_with_0d0a b/actionmailer/test/fixtures/raw_email_quoted_with_0d0a deleted file mode 100644 index 8a2c25a5dd..0000000000 --- a/actionmailer/test/fixtures/raw_email_quoted_with_0d0a +++ /dev/null @@ -1,14 +0,0 @@ -Mime-Version: 1.0 (Apple Message framework v730) -Message-Id: <9169D984-4E0B-45EF-82D4-8F5E53AD7012@example.com> -From: foo@example.com -Subject: testing -Date: Mon, 6 Jun 2005 22:21:22 +0200 -To: blah@example.com -Content-Transfer-Encoding: quoted-printable -Content-Type: text/plain - -A fax has arrived from remote ID ''.=0D=0A-----------------------= --------------------------------------=0D=0ATime: 3/9/2006 3:50:52= - PM=0D=0AReceived from remote ID: =0D=0AInbound user ID XXXXXXXXXX, r= -outing code XXXXXXXXX=0D=0AResult: (0/352;0/0) Successful Send=0D=0AP= -age record: 1 - 1=0D=0AElapsed time: 00:58 on channel 11=0D=0A diff --git a/actionmailer/test/fixtures/raw_email_with_invalid_characters_in_content_type b/actionmailer/test/fixtures/raw_email_with_invalid_characters_in_content_type deleted file mode 100644 index a8ff7ed4cb..0000000000 --- a/actionmailer/test/fixtures/raw_email_with_invalid_characters_in_content_type +++ /dev/null @@ -1,104 +0,0 @@ -Return-Path: -Received: from some.isp.com by baci with ESMTP id 632BD5758 for ; Sun, 21 Oct 2007 19:38:21 +1000 -Date: Sun, 21 Oct 2007 19:38:13 +1000 -From: Mikel Lindsaar -Reply-To: Mikel Lindsaar -To: mikel.lindsaar@baci -Message-Id: <009601c813c6$19df3510$0437d30a@mikel091a> -Subject: Testing outlook -Mime-Version: 1.0 -Content-Type: multipart/alternative; boundary=----=_NextPart_000_0093_01C81419.EB75E850 -Delivered-To: mikel.lindsaar@baci -X-Mimeole: Produced By Microsoft MimeOLE V6.00.2900.3138 -X-Msmail-Priority: Normal - -This is a multi-part message in MIME format. - - -------=_NextPart_000_0093_01C81419.EB75E850 -Content-Type: text/plain; charset=iso-8859-1 -Content-Transfer-Encoding: Quoted-printable - -Hello -This is an outlook test - -So there. - -Me. - -------=_NextPart_000_0093_01C81419.EB75E850 -Content-Type: text/html; charset=iso-8859-1 -Content-Transfer-Encoding: Quoted-printable - - - - - - - - -
Hello
-
This is an outlook=20 -test
-
 
-
So there.
-
 
-
Me.
- - -------=_NextPart_000_0093_01C81419.EB75E850-- - - -Return-Path: -Received: from some.isp.com by baci with ESMTP id 632BD5758 for ; Sun, 21 Oct 2007 19:38:21 +1000 -Date: Sun, 21 Oct 2007 19:38:13 +1000 -From: Mikel Lindsaar -Reply-To: Mikel Lindsaar -To: mikel.lindsaar@baci -Message-Id: <009601c813c6$19df3510$0437d30a@mikel091a> -Subject: Testing outlook -Mime-Version: 1.0 -Content-Type: multipart/alternative; boundary=----=_NextPart_000_0093_01C81419.EB75E850 -Delivered-To: mikel.lindsaar@baci -X-Mimeole: Produced By Microsoft MimeOLE V6.00.2900.3138 -X-Msmail-Priority: Normal - -This is a multi-part message in MIME format. - - -------=_NextPart_000_0093_01C81419.EB75E850 -Content-Type: text/plain; charset=iso-8859-1 -Content-Transfer-Encoding: Quoted-printable - -Hello -This is an outlook test - -So there. - -Me. - -------=_NextPart_000_0093_01C81419.EB75E850 -Content-Type: text/html; charset=iso-8859-1 -Content-Transfer-Encoding: Quoted-printable - - - - - - - - -
Hello
-
This is an outlook=20 -test
-
 
-
So there.
-
 
-
Me.
- - -------=_NextPart_000_0093_01C81419.EB75E850-- - - diff --git a/actionmailer/test/fixtures/raw_email_with_nested_attachment b/actionmailer/test/fixtures/raw_email_with_nested_attachment deleted file mode 100644 index 429c408c5d..0000000000 --- a/actionmailer/test/fixtures/raw_email_with_nested_attachment +++ /dev/null @@ -1,100 +0,0 @@ -From jamis@37signals.com Thu Feb 22 11:20:31 2007 -Mime-Version: 1.0 (Apple Message framework v752.3) -Message-Id: <2CCE0408-10C7-4045-9B16-A1C11C31469B@37signals.com> -Content-Type: multipart/signed; - micalg=sha1; - boundary=Apple-Mail-42-587703407; - protocol="application/pkcs7-signature" -To: Jamis Buck -Subject: Testing attachments -From: Jamis Buck -Date: Thu, 22 Feb 2007 11:20:31 -0700 - - ---Apple-Mail-42-587703407 -Content-Type: multipart/mixed; - boundary=Apple-Mail-41-587703287 - - ---Apple-Mail-41-587703287 -Content-Transfer-Encoding: 7bit -Content-Type: text/plain; - charset=US-ASCII; - format=flowed - -Here is a test of an attachment via email. - -- Jamis - - ---Apple-Mail-41-587703287 -Content-Transfer-Encoding: base64 -Content-Type: image/png; - x-unix-mode=0644; - name=byo-ror-cover.png -Content-Disposition: inline; - filename=truncated.png - -iVBORw0KGgoAAAANSUhEUgAAAKUAAADXCAYAAAB7wZEQAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz -AAALEgAACxIB0t1+/AAAABd0RVh0Q3JlYXRpb24gVGltZQAxLzI1LzIwMDeD9CJVAAAAGHRFWHRT -b2Z0d2FyZQBBZG9iZSBGaXJld29ya3NPsx9OAAAyBWlUWHRYTUw6Y29tLmFkb2JlLnhtcDw/eHBh -Y2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+Cjx4OnhtcG1l -dGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDQuMS1j -MDIwIDEuMjU1NzE2LCBUdWUgT2N0IDEwIDIwMDYgMjM6MTY6MzQiPgogICA8cmRmOlJERiB4bWxu -czpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAg -ICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp4YXA9Imh0 -dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iPgogICAgICAgICA8eGFwOkNyZWF0b3JUb29sPkFk -b2JlIEZpcmV3b3JrcyBDUzM8L3hhcDpDcmVhdG9yVG9vbD4KICAgICAgICAgPHhhcDpDcmVhdGVE -YXRlPjIwMDctMDEtMjVUMDU6Mjg6MjFaPC94YXA6Q3JlYXRlRGF0ZT4KICAgICAgICAgPHhhcDpN -b2RpZnlEYXRlPjIwMDctMDEtMjVUMDU6Mjg6MjFaPC94YXA6TW9kaWZ5RGF0ZT4KICAgICAgPC9y -ZGY6RGVzY3JpcHRpb24+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAg -ICAgICAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyI+CiAgICAg -ICAgIDxkYzpmb3JtYXQ+aW1hZ2UvcG5nPC9kYzpmb3JtYXQ+CiAgICAgIDwvcmRmOkRlc2NyaXB0 -hhojpmnJMfaYFmSkXWg5PGCmHXVj/c9At0hSK2xGdd8F3muk0VFjb4f5Ue0ksQ8qAcq0delaXhdb -DjKNnF+3B3t9kObZYmk7AZgWYqO9anpR3wpM9sQ5XslB9a+kWyTtNb0fOmudzGHfPFBQDKesyycm -DBL7Cw5bXjIEuci+SSOm/LYnXDZu6iuPEj8lYBb+OU8xx1f9m+e5rhJiYKqjo5vHfiZp+VUkW9xc -Ufd6JHNWc47PkQqb9ie3SLEZB/ZqyAssiqURY+G35iOMZUrHbasHnb80QAPv9FHtAbJIyro7bi5b -ai2TEAKen5+LJNWrglZjm3UbZvt7KryA2J5b5J1jZF8kL6GzvG1Zqx54Y1y7J7n20wMOt9frG2sW -uwGP07kNz3732vf6bfvAvLldfS+9fts2euXY37D+R29FGZdlnhzV4TTFmPJduBP2RbNNua4rTqcT -Qt7Xy1KUB0AHSdP5AZQYvHZg7WD1XvYeMO1A9HhZPqMX5KXbMBrn2efxns/ee21674efxz4Tp/fq -2HZ648dgYaC1i3Vq1IbNPq3PvDTPezY9FaRISjvnzWqdgcWN8EJgjnNq+Z7ktOm9l2Nfth28EZi4 -bG/we5JwxM+Tql47/D/X6b38I8/RyxvxPJrX6zvQbo3h9jyJx+C0ALX327QETHl5eYlaYCT5rPTb -+5/rAq26t3lKIxV/p88hq6ptngdgCzoPjJqndiLfc/6y5A14WeDFGNPct4iUsJBV2bYzLEV7m83s -6Rp63VPhHKC/g/LzaU9qexJRr56043JWinqAtfZqsSm1sjoznthl54dtCqv+uL4nIY+oYWuc3+nH -kGfn8b0HQpvOYLQAZUDanbJs3jQhITZEgdarZK+cO6ySlL13rut5nFaN23s7u3Snz6eRPTkCoc2/ -Vp1zHfZVFpZ87FiMVLV1iqyK5rlzfji2GzjfDsodlD+Weo5UD4h6PwKqzQMqID0tq2VjjFVSMpis -ZLRAs7sePZBZAHI+gIanB8I7MD+femAceeUe2Kxa5jS950kZ1p5eNEdeX1+jFmSpZ+1EdWCsDcne -NPNgUHNw3aYpnzv9PGTX0uo94EtN9qq1rOdxe3kc79T8ukeHJJ8Fnxej6qlylbLLsjQLOy6Xy2a1 -kefs/N+nM7+S7IG5/E5Yc7F003pWErLjbH0O5cGadiMptSB/DZ5U5DI9yeg5MFYyMj8lC/Y7/Xjq -OZlWcnpg9aQfXz2HRq+Wn5xOp6gN8tWq8R44e2pfyzLYemEgprst+XXk2Zj2nXlbsG05BprndTMv -C3QRaXczshhVsHnMgfYn80Y2g5JureA6wBasPeP7LkE/jvZMJAaf/g/U2RelHsisvan5FqweIAHg -Pwc7L68GxvVDAAAAAElFTkSuQmCC - ---Apple-Mail-41-587703287-- - ---Apple-Mail-42-587703407 -Content-Transfer-Encoding: base64 -Content-Type: application/pkcs7-signature; - name=smime.p7s -Content-Disposition: attachment; - filename=smime.p7s - -MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGJzCCAuAw -ggJJoAMCAQICEFjnFNYXwDEZRWY5EkfzopUwDQYJKoZIhvcNAQEFBQAwYjELMAkGA1UEBhMCWkEx -JTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQ -ZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA2MDkxMjE3MDExMloXDTA3MDkxMjE3MDEx -MlowRTEfMB0GA1UEAxMWVGhhd3RlIEZyZWVtYWlsIE1lbWJlcjEiMCAGCSqGSIb3DQEJARYTamFt -aXNAMzdzaWduYWxzLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAO2A9JeOFIFJ -G6z8pTcAldrZ2nMe+Xb1tNrbHgoVzN/QhHXM4qst2Ml93cmFLjMmwG7P9RJeU4oNx+jTqVoBB7NV -Ne1/o56Do0KhfMZ9iUDQdPLbkZMq4EEpFMdm6PyM3muRKwPhj66iAWe/osCb8DowUK2f66vaRx0Z -Y0MQHIIrXE02Ta4IfAhIfPqBLkZ4WgTYBHN9vMdYea1jF0GO4gqGk1wqwb3yxv2QMYMbwJ6SI+k/ -ZjkSR/OilTCBhwYLKoZIhvcNAQkQAgsxeKB2MGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3 -dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1h -aWwgSXNzdWluZyBDQQIQWOcU1hfAMRlFZjkSR/OilTANBgkqhkiG9w0BAQEFAASCAQCfwQiC3v6/ -yleRDGv3bJ4nQYQ+c3mz3+mn3Xi6uU35n3piwxZZaWRdmLyiXPvU+QReHpSf3l2qsEZM3sdE0XF9 -eRul/+QTFJcDNXOEAxG1zC2Gpz+6c6RrX4Ou12Pwkp+pNrZWTSY/mZgdqcArupOBcZi7qBjoWcy5 -wb54dfvSSjrjmqLbkH/E8ww/6gGQuU/xXpAUZgUrTmQHrNKeIdSh5oDkOxFaFWvnmb8Z/2ixKqW/ -Ux6WqamyvBtTs/5YBEtnpZOk+uVoscYEUBhU+DVJ2OSvTdXSivMtBdXmGTsG22k+P1NGUHi/A7ev -xPaO0uk4V8xyjNlN4HPuGpkrlXwPAAAAAAAA - ---Apple-Mail-42-587703407-- diff --git a/actionmailer/test/fixtures/raw_email_with_partially_quoted_subject b/actionmailer/test/fixtures/raw_email_with_partially_quoted_subject deleted file mode 100644 index e86108da1e..0000000000 --- a/actionmailer/test/fixtures/raw_email_with_partially_quoted_subject +++ /dev/null @@ -1,14 +0,0 @@ -From jamis@37signals.com Mon May 2 16:07:05 2005 -Mime-Version: 1.0 (Apple Message framework v622) -Content-Transfer-Encoding: base64 -Message-Id: -Content-Type: text/plain; - charset=EUC-KR; - format=flowed -To: jamis@37signals.com -From: Jamis Buck -Subject: Re: Test: =?UTF-8?B?Iua8ouWtlyI=?= mid =?UTF-8?B?Iua8ouWtlyI=?= tail -Date: Mon, 2 May 2005 16:07:05 -0600 - -tOu6zrrQwMcguLbC+bChwfa3ziwgv+y4rrTCIMfPs6q01MC7ILnPvcC0z7TZLg0KDQrBpiDAzLin -wLogSmFtaXPA1LTPtNku -- cgit v1.2.3 From ba46d524db1d8a76a12bb4cc589d1c0943fe645c Mon Sep 17 00:00:00 2001 From: Waynn Lue Date: Thu, 12 Sep 2013 14:44:38 -0700 Subject: take out reference to previous versions of Rails --- actionmailer/README.rdoc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/README.rdoc b/actionmailer/README.rdoc index 178572706c..96dd0b1a2e 100644 --- a/actionmailer/README.rdoc +++ b/actionmailer/README.rdoc @@ -61,9 +61,7 @@ generated would look like this: Thank you for signing up! -In previous versions of Rails you would call create_method_name and -deliver_method_name. Rails 3.0 has a much simpler interface - you -simply call the method and optionally call +deliver+ on the return value. +In order to send mails, you simply call the method and then call +deliver+ on the return value. Calling the method returns a Mail Message object: -- cgit v1.2.3 From f72437bf3f24fa6ed9543b3b77d47a3f0fd593a0 Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Sun, 20 Oct 2013 10:31:41 +0530 Subject: Remove extra variable creation and merge. --- actionmailer/lib/action_mailer/base.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index ada86fbc4f..f3d778f0bd 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -685,9 +685,9 @@ module ActionMailer content_type = headers[:content_type] # Call all the procs (if any) - class_default = self.class.default - default_values = class_default.merge(class_default) do |k,v| - v.is_a?(Proc) ? instance_eval(&v) : v + default_values = {} + self.class.default.each do |k,v| + default_values[k] = v.is_a?(Proc) ? instance_eval(&v) : v end # Handle defaults -- cgit v1.2.3 From 8f0c5e00ff61cc2f61acedfb35de756bd0e95437 Mon Sep 17 00:00:00 2001 From: Daniel Schierbeck Date: Wed, 16 Oct 2013 10:32:06 +0200 Subject: Instrument the generation of Action Mailer messages The processing of outbound mail is instrumented with the key `process.action_mailer`. The payload includes the mailer name as well as the mailer method. --- actionmailer/CHANGELOG.md | 5 +++++ actionmailer/lib/action_mailer/base.rb | 15 +++++++++++---- actionmailer/lib/action_mailer/log_subscriber.rb | 7 +++++++ actionmailer/test/log_subscriber_test.rb | 9 ++++++--- 4 files changed, 29 insertions(+), 7 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/CHANGELOG.md b/actionmailer/CHANGELOG.md index 1659696bfb..d84b95e6e9 100644 --- a/actionmailer/CHANGELOG.md +++ b/actionmailer/CHANGELOG.md @@ -1,3 +1,8 @@ +* Instrument the generation of Action Mailer messages. The time it takes to + generate a message is written to the log. + + *Daniel Schierbeck* + * invoke mailer defaults as procs only if they are procs, do not convert with to_proc. That an object is convertible to a proc does not mean it's meant to be always used as a proc. Fixes #11533 diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index ada86fbc4f..6357805198 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -511,11 +511,18 @@ module ActionMailer process(method_name, *args) if method_name end - def process(*args) #:nodoc: - lookup_context.skip_default_locale! + def process(method_name, *args) #:nodoc: + payload = { + :mailer => self.class.name, + :action => method_name + } - super - @_message = NullMail.new unless @_mail_was_called + ActiveSupport::Notifications.instrument("process.action_mailer", payload) do + lookup_context.skip_default_locale! + + super + @_message = NullMail.new unless @_mail_was_called + end end class NullMail #:nodoc: diff --git a/actionmailer/lib/action_mailer/log_subscriber.rb b/actionmailer/lib/action_mailer/log_subscriber.rb index 8467d45986..eb6fb11d81 100644 --- a/actionmailer/lib/action_mailer/log_subscriber.rb +++ b/actionmailer/lib/action_mailer/log_subscriber.rb @@ -19,6 +19,13 @@ module ActionMailer debug(event.payload[:mail]) end + # An email was generated. + def process(event) + mailer = event.payload[:mailer] + action = event.payload[:action] + debug("\n#{mailer}##{action}: processed outbound mail in #{event.duration.round(1)}ms") + end + # Use the logger configured for ActionMailer::Base def logger ActionMailer::Base.logger diff --git a/actionmailer/test/log_subscriber_test.rb b/actionmailer/test/log_subscriber_test.rb index 5f52a1bd69..5f0bee88fd 100644 --- a/actionmailer/test/log_subscriber_test.rb +++ b/actionmailer/test/log_subscriber_test.rb @@ -24,10 +24,13 @@ class AMLogSubscriberTest < ActionMailer::TestCase def test_deliver_is_notified BaseMailer.welcome.deliver wait + assert_equal(1, @logger.logged(:info).size) assert_match(/Sent mail to system@test.lindsaar.net/, @logger.logged(:info).first) - assert_equal(1, @logger.logged(:debug).size) - assert_match(/Welcome/, @logger.logged(:debug).first) + + assert_equal(2, @logger.logged(:debug).size) + assert_match(/BaseMailer#welcome: processed outbound mail in [\d.]+ms/, @logger.logged(:debug).first) + assert_match(/Welcome/, @logger.logged(:debug).second) end def test_receive_is_notified @@ -39,4 +42,4 @@ class AMLogSubscriberTest < ActionMailer::TestCase assert_equal(1, @logger.logged(:debug).size) assert_match(/Jamis/, @logger.logged(:debug).first) end -end \ No newline at end of file +end -- cgit v1.2.3 From 267e5c84f96b96f8eac9f4a3dcdce5bc1b82541c Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 6 Nov 2013 14:21:40 -0800 Subject: calculate the ivars to remove in advance as a set and cache them in a constant. `view_assigns` can use the precalculated sets and remove instance variables without allocating any extra arrays --- actionmailer/lib/action_mailer/base.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index becd4126f4..2207f119c3 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -373,7 +373,11 @@ module ActionMailer include AbstractController::AssetPaths include AbstractController::Callbacks - self.protected_instance_variables = [:@_action_has_layout] + PROTECTED_IVARS = AbstractController::Rendering::DEFAULT_PROTECTED_INSTANCE_VARIABLES + [:@_action_has_layout] + + def _protected_ivars # :nodoc: + PROTECTED_IVARS + end helper ActionMailer::MailHelper -- cgit v1.2.3 From a1f1e6d9e20a8d527eff900a865a270be2c0d794 Mon Sep 17 00:00:00 2001 From: Harshad Sabne Date: Fri, 8 Nov 2013 13:28:14 +0530 Subject: Update README.rdoc [ci skip] Highlighted code --- actionmailer/README.rdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionmailer') diff --git a/actionmailer/README.rdoc b/actionmailer/README.rdoc index 96dd0b1a2e..c3dcd3c3e4 100644 --- a/actionmailer/README.rdoc +++ b/actionmailer/README.rdoc @@ -74,7 +74,7 @@ Or you can just chain the methods together like: == Setting defaults -It is possible to set default values that will be used in every method in your Action Mailer class. To implement this functionality, you just call the public class method default which you get for free from ActionMailer::Base. This method accepts a Hash as the parameter. You can use any of the headers e-mail messages has, like :from as the key. You can also pass in a string as the key, like "Content-Type", but Action Mailer does this out of the box for you, so you won't need to worry about that. Finally, it is also possible to pass in a Proc that will get evaluated when it is needed. +It is possible to set default values that will be used in every method in your Action Mailer class. To implement this functionality, you just call the public class method default which you get for free from ActionMailer::Base. This method accepts a Hash as the parameter. You can use any of the headers e-mail messages has, like :from as the key. You can also pass in a string as the key, like "Content-Type", but Action Mailer does this out of the box for you, so you won't need to worry about that. Finally, it is also possible to pass in a Proc that will get evaluated when it is needed. Note that every value you set with this method will get overwritten if you use the same key in your mailer method. -- cgit v1.2.3 From 3134605391e4d5cf270f2ba79ea810eee4cffc5a Mon Sep 17 00:00:00 2001 From: Mr A Date: Thu, 14 Nov 2013 13:41:37 +0530 Subject: Ruby's new Hash syntax applied in actionmailer --- actionmailer/lib/action_mailer/base.rb | 4 ++-- .../test/fixtures/base_mailer/email_with_translations.html.erb | 2 +- actionmailer/test/fixtures/test_mailer/included_subtemplate.text.erb | 2 +- actionmailer/test/mailers/base_mailer.rb | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 2207f119c3..501fee55aa 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -517,8 +517,8 @@ module ActionMailer def process(method_name, *args) #:nodoc: payload = { - :mailer => self.class.name, - :action => method_name + mailer: self.class.name, + action: method_name } ActiveSupport::Notifications.instrument("process.action_mailer", payload) do diff --git a/actionmailer/test/fixtures/base_mailer/email_with_translations.html.erb b/actionmailer/test/fixtures/base_mailer/email_with_translations.html.erb index 30466dd005..d676a6d2da 100644 --- a/actionmailer/test/fixtures/base_mailer/email_with_translations.html.erb +++ b/actionmailer/test/fixtures/base_mailer/email_with_translations.html.erb @@ -1 +1 @@ -<%= t('.greet_user', :name => 'lifo') %> \ No newline at end of file +<%= t('.greet_user', name: 'lifo') %> \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.erb b/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.erb index a93c30ea1a..ae3cfa77e7 100644 --- a/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.erb +++ b/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.erb @@ -1 +1 @@ -Hey Ho, <%= render :partial => "subtemplate" %> \ No newline at end of file +Hey Ho, <%= render partial: "subtemplate" %> \ No newline at end of file diff --git a/actionmailer/test/mailers/base_mailer.rb b/actionmailer/test/mailers/base_mailer.rb index 6584bf5195..bd991e209e 100644 --- a/actionmailer/test/mailers/base_mailer.rb +++ b/actionmailer/test/mailers/base_mailer.rb @@ -120,7 +120,7 @@ class BaseMailer < ActionMailer::Base end def with_nil_as_return_value - mail(:template_name => "welcome") + mail(template_name: "welcome") nil end -- cgit v1.2.3 From 18964368f3725e166719b6dc1f4b6546f6ef9e0c Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Fri, 22 Nov 2013 08:30:03 -0200 Subject: Improve changelogs Also make Action Mailer changelog format more consistent with the others [ci skip] --- actionmailer/CHANGELOG.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/CHANGELOG.md b/actionmailer/CHANGELOG.md index d84b95e6e9..dc8c6bdf74 100644 --- a/actionmailer/CHANGELOG.md +++ b/actionmailer/CHANGELOG.md @@ -1,12 +1,14 @@ -* Instrument the generation of Action Mailer messages. The time it takes to - generate a message is written to the log. +* Instrument the generation of Action Mailer messages. The time it takes to + generate a message is written to the log. - *Daniel Schierbeck* + *Daniel Schierbeck* -* invoke mailer defaults as procs only if they are procs, do not convert - with to_proc. That an object is convertible to a proc does not mean it's - meant to be always used as a proc. Fixes #11533 +* Invoke mailer defaults as procs only if they are procs, do not convert with + `to_proc`. That an object is convertible to a proc does not mean it's meant + to be always used as a proc. - *Alex Tsukernik* + Fixes #11533. + + *Alex Tsukernik* Please check [4-0-stable](https://github.com/rails/rails/blob/4-0-stable/actionmailer/CHANGELOG.md) for previous changes. -- cgit v1.2.3 From 23aa94a7b2d51536baa5eb91a8cd50cdd6dfa99e Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Mon, 2 Dec 2013 16:51:13 +0100 Subject: `mail()` without arguments is a getter for the current mail. This behavior is documented in our guides (http://edgeguides.rubyonrails.org/action_mailer_basics.html#action-mailer-callbacks) but was broken in the past. This commit short curcuits the `mail` method if: 1. mail() was previously called 2. no headers are passed 3. no block is passed Closes #13090. /cc @pixeltrix --- actionmailer/CHANGELOG.md | 19 +++++++++++++++++++ actionmailer/lib/action_mailer/base.rb | 2 ++ actionmailer/test/base_test.rb | 21 +++++++++++++++++++++ 3 files changed, 42 insertions(+) (limited to 'actionmailer') diff --git a/actionmailer/CHANGELOG.md b/actionmailer/CHANGELOG.md index dc8c6bdf74..857cde399a 100644 --- a/actionmailer/CHANGELOG.md +++ b/actionmailer/CHANGELOG.md @@ -1,3 +1,22 @@ +* Calling `mail()` without arguments serves as getter for the current mail + message and keeps previously set headers. + + Example: + + class MailerWithCallback < ActionMailer::Base + after_action :a_callback + + def welcome + mail subject: "subject", to: ["joe@example.com"] + end + + def a_callback + mail # => returns the current mail message + end + end + + *Yves Senn* + * Instrument the generation of Action Mailer messages. The time it takes to generate a message is written to the log. diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 501fee55aa..6f8ae05539 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -689,6 +689,8 @@ module ActionMailer # end # def mail(headers = {}, &block) + return @_message if @_mail_was_called && headers.blank? && !block + @_mail_was_called = true m = @_message diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index b74728ae34..c1759d9b92 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -671,6 +671,27 @@ class BaseTest < ActiveSupport::TestCase assert_equal ["robert.pankowecki@gmail.com"], DefaultFromMailer.welcome.from end + test "mail() without arguments serves as getter for the current mail message" do + class MailerWithCallback < ActionMailer::Base + after_action :a_callback + + def welcome + headers('X-Special-Header' => 'special indeed!') + mail subject: "subject", body: "hello world", to: ["joe@example.com"] + end + + def a_callback + mail.to << "jane@example.com" + end + end + + mail = MailerWithCallback.welcome + assert_equal "subject", mail.subject + assert_equal ["joe@example.com", "jane@example.com"], mail.to + assert_equal "hello world", mail.body.encoded.strip + assert_equal "special indeed!", mail["X-Special-Header"].to_s + end + protected # Execute the block setting the given values and restoring old values after -- cgit v1.2.3 From d8888b94b32b28003ec247d0565e73dee731275e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Strza=C5=82kowski?= Date: Thu, 5 Dec 2013 00:17:39 +0100 Subject: Retain ActionPack dependency on ActionView --- actionmailer/test/i18n_with_controller_test.rb | 3 --- 1 file changed, 3 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/test/i18n_with_controller_test.rb b/actionmailer/test/i18n_with_controller_test.rb index ab5eaaa9d5..14a1b11b6d 100644 --- a/actionmailer/test/i18n_with_controller_test.rb +++ b/actionmailer/test/i18n_with_controller_test.rb @@ -15,9 +15,6 @@ class I18nTestMailer < ActionMailer::Base end end -# Emulate AV railtie -ActionController::Base.superclass.send(:include, ActionView::Layouts) - class TestController < ActionController::Base def send_mail I18nTestMailer.mail_with_i18n_subject("test@localhost").deliver -- cgit v1.2.3 From e064658d64f7fb071ec35764f2d5203e8b58e044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Strza=C5=82kowski?= Date: Thu, 5 Dec 2013 00:22:50 +0100 Subject: Include AV::Layouts directly in AM::Base No need to do this in railtie as AM depends on AV either way --- actionmailer/lib/action_mailer/base.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 6f8ae05539..5723b2cc1b 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -373,6 +373,8 @@ module ActionMailer include AbstractController::AssetPaths include AbstractController::Callbacks + include ActionView::Layouts + PROTECTED_IVARS = AbstractController::Rendering::DEFAULT_PROTECTED_INSTANCE_VARIABLES + [:@_action_has_layout] def _protected_ivars # :nodoc: -- cgit v1.2.3 From d6dec7fcb6b8fddf8c170182d4fe64ecfc7b2261 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Mon, 16 Dec 2013 05:52:58 +0000 Subject: Add mailer previews feature based on mail_view gem --- actionmailer/CHANGELOG.md | 4 ++ actionmailer/lib/action_mailer.rb | 2 + actionmailer/lib/action_mailer/base.rb | 20 +++++++++ actionmailer/lib/action_mailer/preview.rb | 67 +++++++++++++++++++++++++++++++ actionmailer/lib/action_mailer/railtie.rb | 8 ++++ 5 files changed, 101 insertions(+) create mode 100644 actionmailer/lib/action_mailer/preview.rb (limited to 'actionmailer') diff --git a/actionmailer/CHANGELOG.md b/actionmailer/CHANGELOG.md index 857cde399a..fc9aefd416 100644 --- a/actionmailer/CHANGELOG.md +++ b/actionmailer/CHANGELOG.md @@ -1,3 +1,7 @@ +* Add mailer previews feature based on 37 Signals mail_view gem + + *Andrew White* + * Calling `mail()` without arguments serves as getter for the current mail message and keeps previously set headers. diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb index 5b6960c8fc..557eec4728 100644 --- a/actionmailer/lib/action_mailer.rb +++ b/actionmailer/lib/action_mailer.rb @@ -41,6 +41,8 @@ module ActionMailer autoload :Base autoload :DeliveryMethods autoload :MailHelper + autoload :Preview + autoload :Previews, 'action_mailer/preview' autoload :TestCase autoload :TestHelper end diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 5723b2cc1b..e1f3fd03e2 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -308,6 +308,25 @@ module ActionMailer # Note that unless you have a specific reason to do so, you should prefer using before_action # rather than after_action in your ActionMailer classes so that headers are parsed properly. # + # = Previewing emails + # + # You can preview your email templates visually by adding a mailer preview file to the + # ActionMailer::Base.preview_path. Since most emails do something interesting + # with database data, you'll need to write some scenarios to load messages with fake data: + # + # class NotifierPreview < ActionMailer::Preview + # def welcome + # Notifier.welcome(User.first) + # end + # end + # + # Methods must return a Mail::Message object which can be generated by calling the mailer + # method without the additional deliver. The location of the mailer previews + # directory can be configured using the preview_path option which has a default + # of test/mailers/previews: + # + # config.action_mailer.preview_path = "#{Rails.root}/lib/mailer_previews" + # # = Configuration options # # These options are specified on the class level, like @@ -362,6 +381,7 @@ module ActionMailer # delivery_method :test. Most useful for unit and functional testing. class Base < AbstractController::Base include DeliveryMethods + include Previews abstract! diff --git a/actionmailer/lib/action_mailer/preview.rb b/actionmailer/lib/action_mailer/preview.rb new file mode 100644 index 0000000000..43d9ec4bb5 --- /dev/null +++ b/actionmailer/lib/action_mailer/preview.rb @@ -0,0 +1,67 @@ +require 'active_support/descendants_tracker' + +module ActionMailer + module Previews #:nodoc: + extend ActiveSupport::Concern + + included do + # Set the location of mailer previews through app configuration: + # + # config.action_mailer.preview_path = "#{Rails.root}/lib/mailer_previews" + # + class_attribute :preview_path, instance_writer: false + end + end + + class Preview + extend ActiveSupport::DescendantsTracker + + class << self + # Returns all mailer preview classes + def all + load_previews if descendants.empty? + descendants + end + + # Returns the mail object for the given email name + def call(email) + preview = self.new + preview.public_send(email) + end + + # Returns all of the available email previews + def emails + public_instance_methods(false).map(&:to_s).sort + end + + # Returns true if the email exists + def email_exists?(email) + emails.include?(email) + end + + # Returns true if the preview exists + def exists?(preview) + all.any?{ |p| p.preview_name == preview } + end + + # Find a mailer preview by its underscored class name + def find(preview) + all.find{ |p| p.preview_name == preview } + end + + # Returns the underscored name of the mailer preview without the suffix + def preview_name + name.sub(/Preview$/, '').underscore + end + + protected + def load_previews #:nodoc: + Dir["#{preview_path}/**/*_preview.rb"].each{ |file| require_dependency file } + end + + def preview_path #:nodoc: + Base.preview_path + end + end + end +end diff --git a/actionmailer/lib/action_mailer/railtie.rb b/actionmailer/lib/action_mailer/railtie.rb index 7677ff3a7c..af8009ba97 100644 --- a/actionmailer/lib/action_mailer/railtie.rb +++ b/actionmailer/lib/action_mailer/railtie.rb @@ -40,5 +40,13 @@ module ActionMailer config.compile_methods! if config.respond_to?(:compile_methods!) end end + + initializer "action_mailer.configure_mailer_previews", before: :set_autoload_paths do |app| + if Rails.env.development? + options = app.config.action_mailer + options.preview_path ||= defined?(Rails.root) ? "#{Rails.root}/test/mailers/previews" : nil + app.config.autoload_paths << options.preview_path + end + end end end -- cgit v1.2.3 From 6802196a6b7db928f9dc70fe5a4f3b61a3ea33ce Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Mon, 16 Dec 2013 16:04:07 -0200 Subject: Disable available locales checks to avoid warnings running the tests --- actionmailer/test/abstract_unit.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'actionmailer') diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb index aa18c512c7..cf790c7487 100644 --- a/actionmailer/test/abstract_unit.rb +++ b/actionmailer/test/abstract_unit.rb @@ -20,6 +20,9 @@ ActionMailer::Base.send(:include, ActionView::Layouts) # Show backtraces for deprecated behavior for quicker cleanup. ActiveSupport::Deprecation.debug = true +# Disable available locale checks to avoid warnings running the test suite. +I18n.enforce_available_locales = false + # Bogus template processors ActionView::Template.register_template_handler :haml, lambda { |template| "Look its HAML!".inspect } ActionView::Template.register_template_handler :bak, lambda { |template| "Lame backup".inspect } -- cgit v1.2.3 From c0a2d474c50a3a096229f956d9696d9e91f1557a Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 17 Dec 2013 16:05:28 -0800 Subject: Get ready to release 4.1.0.beta1 --- actionmailer/lib/action_mailer/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/version.rb b/actionmailer/lib/action_mailer/version.rb index 9d00091972..46eb763c26 100644 --- a/actionmailer/lib/action_mailer/version.rb +++ b/actionmailer/lib/action_mailer/version.rb @@ -1,7 +1,7 @@ module ActionMailer # Returns the version of the currently loaded ActionMailer as a Gem::Version def self.version - Gem::Version.new "4.1.0.beta" + Gem::Version.new "4.1.0.beta1" end module VERSION #:nodoc: -- cgit v1.2.3 From 69b5dc7e002946c5196a7a38e2559a7ce08a75c0 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Wed, 18 Dec 2013 14:36:31 +0100 Subject: document how to access mail previews. [ci skip] /cc @pixeltrix --- actionmailer/lib/action_mailer/base.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index e1f3fd03e2..3c21db991c 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -327,6 +327,9 @@ module ActionMailer # # config.action_mailer.preview_path = "#{Rails.root}/lib/mailer_previews" # + # An overview of all previews is accessible at http://localhost:3000/rails/mailers + # on a running development server instance. + # # = Configuration options # # These options are specified on the class level, like -- cgit v1.2.3 From fbbd4e18994490f00509a5269bbca0dd3521c3ae Mon Sep 17 00:00:00 2001 From: Chun-wei Kuo Date: Thu, 26 Dec 2013 18:14:38 +0800 Subject: Improve font of some code in API documentation [ci skip] * Add "" or "+" to improve font of some code and filenames in API documentation * Does not contain wording changes --- actionmailer/lib/action_mailer/base.rb | 35 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 3c21db991c..275f657f8a 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -50,7 +50,7 @@ module ActionMailer # # * mail - Allows you to specify email to be sent. # - # The hash passed to the mail method allows you to specify any header that a Mail::Message + # The hash passed to the mail method allows you to specify any header that a Mail::Message # will accept (any valid Email header including optional fields). # # The mail method, if not passed a block, will inspect your views and send all the views with @@ -229,7 +229,7 @@ module ActionMailer # An interceptor class must implement the :delivering_email(message) method which will be # called before the email is sent, allowing you to make modifications to the email before it hits # the delivery agents. Your class should make any needed modifications directly to the passed - # in Mail::Message instance. + # in Mail::Message instance. # # = Default Hash # @@ -320,7 +320,7 @@ module ActionMailer # end # end # - # Methods must return a Mail::Message object which can be generated by calling the mailer + # Methods must return a Mail::Message object which can be generated by calling the mailer # method without the additional deliver. The location of the mailer previews # directory can be configured using the preview_path option which has a default # of test/mailers/previews: @@ -339,7 +339,7 @@ module ActionMailer # per the above section. # # * logger - the logger is used for generating information on the mailing run if available. - # Can be set to nil for no logging. Compatible with both Ruby's own Logger and Log4r loggers. + # Can be set to +nil+ for no logging. Compatible with both Ruby's own +Logger+ and Log4r loggers. # # * smtp_settings - Allows detailed configuration for :smtp delivery method: # * :address - Allows you to use a remote mail server. Just change it from its default @@ -357,8 +357,9 @@ module ActionMailer # and starts to use it. # * :openssl_verify_mode - When using TLS, you can set how OpenSSL checks the certificate. This is # really useful if you need to validate a self-signed and/or a wildcard certificate. You can use the name - # of an OpenSSL verify constant ('none', 'peer', 'client_once', 'fail_if_no_peer_cert') or directly the - # constant (OpenSSL::SSL::VERIFY_NONE, OpenSSL::SSL::VERIFY_PEER, ...). + # of an OpenSSL verify constant ('none', 'peer', 'client_once', + # 'fail_if_no_peer_cert') or directly the constant (OpenSSL::SSL::VERIFY_NONE, + # OpenSSL::SSL::VERIFY_PEER, ...). # # * sendmail_settings - Allows you to override options for the :sendmail delivery method. # * :location - The location of the sendmail executable. Defaults to /usr/sbin/sendmail. @@ -373,7 +374,7 @@ module ActionMailer # # * delivery_method - Defines a delivery method. Possible values are :smtp (default), # :sendmail, :test, and :file. Or you may provide a custom delivery method - # object e.g. MyOwnDeliveryMethodClass. See the Mail gem documentation on the interface you need to + # object e.g. +MyOwnDeliveryMethodClass+. See the Mail gem documentation on the interface you need to # implement for a custom delivery agent. # # * perform_deliveries - Determines whether emails are actually sent from Action Mailer when you @@ -429,7 +430,7 @@ module ActionMailer # Register an Observer which will be notified when mail is delivered. # Either a class or a string can be passed in as the Observer. If a string is passed in - # it will be +constantize+d. + # it will be constantized. def register_observer(observer) delivery_observer = (observer.is_a?(String) ? observer.constantize : observer) Mail.register_observer(delivery_observer) @@ -487,11 +488,11 @@ module ActionMailer end end - # Wraps an email delivery inside of ActiveSupport::Notifications instrumentation. + # Wraps an email delivery inside of ActiveSupport::Notifications instrumentation. # - # This method is actually called by the Mail::Message object itself - # through a callback when you call +:deliver+ on the Mail::Message, - # calling +deliver_mail+ directly and passing a Mail::Message will do + # This method is actually called by the Mail::Message object itself + # through a callback when you call :deliver on the Mail::Message, + # calling +deliver_mail+ directly and passing a Mail::Message will do # nothing except tell the logger you sent the email. def deliver_mail(mail) #:nodoc: ActiveSupport::Notifications.instrument("deliver.action_mailer") do |payload| @@ -567,18 +568,18 @@ module ActionMailer self.class.mailer_name end - # Allows you to pass random and unusual headers to the new Mail::Message + # Allows you to pass random and unusual headers to the new Mail::Message # object which will add them to itself. # # headers['X-Special-Domain-Specific-Header'] = "SecretValue" # # You can also pass a hash into headers of header field names and values, - # which will then be set on the Mail::Message object: + # which will then be set on the Mail::Message object: # # headers 'X-Special-Domain-Specific-Header' => "SecretValue", # 'In-Reply-To' => incoming.message_id # - # The resulting Mail::Message will have the following in its header: + # The resulting Mail::Message will have the following in its header: # # X-Special-Domain-Specific-Header: SecretValue def headers(args = nil) @@ -667,8 +668,8 @@ module ActionMailer # templates in the view paths using by default the mailer name and the # method name that it is being called from, it will then create parts for # each of these templates intelligently, making educated guesses on correct - # content type and sequence, and return a fully prepared Mail::Message - # ready to call +:deliver+ on to send. + # content type and sequence, and return a fully prepared Mail::Message + # ready to call :deliver on to send. # # For example: # -- cgit v1.2.3 From 98cb3e69afd687f7c0d4bc48eabf284da691abcc Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Wed, 1 Jan 2014 23:59:49 +0530 Subject: update copyright notices to 2014. [ci skip] --- actionmailer/MIT-LICENSE | 2 +- actionmailer/lib/action_mailer.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/MIT-LICENSE b/actionmailer/MIT-LICENSE index 5c668d9624..d58dd9ed9b 100644 --- a/actionmailer/MIT-LICENSE +++ b/actionmailer/MIT-LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2013 David Heinemeier Hansson +Copyright (c) 2004-2014 David Heinemeier Hansson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb index 557eec4728..83969d4074 100644 --- a/actionmailer/lib/action_mailer.rb +++ b/actionmailer/lib/action_mailer.rb @@ -1,5 +1,5 @@ #-- -# Copyright (c) 2004-2013 David Heinemeier Hansson +# Copyright (c) 2004-2014 David Heinemeier Hansson # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the -- cgit v1.2.3 From 3713e433667ee95caccb53a4062f540405272234 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Sat, 4 Jan 2014 18:42:34 +0000 Subject: Add preview_path to autoload_paths in after_initialize Only config.autoload_paths is frozen, so add the preview_path to ActiveSupport::Dependencies.autoload_paths directly in an after_initialize block. Also protect against a blank preview_path being added to autoload_paths which can cause a serious slowdown as Dir[] tries to load all *_preview.rb files under / Fixes #13372 --- actionmailer/lib/action_mailer/preview.rb | 8 +++++++- actionmailer/lib/action_mailer/railtie.rb | 12 +++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/preview.rb b/actionmailer/lib/action_mailer/preview.rb index 43d9ec4bb5..ecceaf8c70 100644 --- a/actionmailer/lib/action_mailer/preview.rb +++ b/actionmailer/lib/action_mailer/preview.rb @@ -56,12 +56,18 @@ module ActionMailer protected def load_previews #:nodoc: - Dir["#{preview_path}/**/*_preview.rb"].each{ |file| require_dependency file } + if preview_path? + Dir["#{preview_path}/**/*_preview.rb"].each{ |file| require_dependency file } + end end def preview_path #:nodoc: Base.preview_path end + + def preview_path? #:nodoc: + Base.preview_path? + end end end end diff --git a/actionmailer/lib/action_mailer/railtie.rb b/actionmailer/lib/action_mailer/railtie.rb index af8009ba97..c893ddfef5 100644 --- a/actionmailer/lib/action_mailer/railtie.rb +++ b/actionmailer/lib/action_mailer/railtie.rb @@ -19,6 +19,10 @@ module ActionMailer options.javascripts_dir ||= paths["public/javascripts"].first options.stylesheets_dir ||= paths["public/stylesheets"].first + if Rails.env.development? + options.preview_path ||= defined?(Rails.root) ? "#{Rails.root}/test/mailers/previews" : nil + end + # make sure readers methods get compiled options.asset_host ||= app.config.asset_host options.relative_url_root ||= app.config.relative_url_root @@ -41,11 +45,9 @@ module ActionMailer end end - initializer "action_mailer.configure_mailer_previews", before: :set_autoload_paths do |app| - if Rails.env.development? - options = app.config.action_mailer - options.preview_path ||= defined?(Rails.root) ? "#{Rails.root}/test/mailers/previews" : nil - app.config.autoload_paths << options.preview_path + config.after_initialize do + if ActionMailer::Base.preview_path? + ActiveSupport::Dependencies.autoload_paths << ActionMailer::Base.preview_path end end end -- cgit v1.2.3 From 535bd55fcd1d956d923da5c21976d8ba0b8c00af Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Mon, 6 Jan 2014 10:57:00 +0100 Subject: quick formatting pass through CHANGELOGS. [ci skip]. --- actionmailer/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'actionmailer') diff --git a/actionmailer/CHANGELOG.md b/actionmailer/CHANGELOG.md index fc9aefd416..1867a392eb 100644 --- a/actionmailer/CHANGELOG.md +++ b/actionmailer/CHANGELOG.md @@ -5,6 +5,8 @@ * Calling `mail()` without arguments serves as getter for the current mail message and keeps previously set headers. + Fixes #13090. + Example: class MailerWithCallback < ActionMailer::Base -- cgit v1.2.3