]> source.dussan.org Git - redmine.git/commitdiff
Do not send an email with no recipient, cc or bcc (closes #743).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 26 Feb 2008 18:30:24 +0000 (18:30 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 26 Feb 2008 18:30:24 +0000 (18:30 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1174 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/mailer.rb

index 75a2e960be4bb5912f8afea786790aef6fec7f65..ad5a3647ba42d358bb7c3db982342e9cfecba204 100644 (file)
@@ -122,7 +122,16 @@ class Mailer < ActionMailer::Base
     subject 'Redmine test'
     body :url => url_for(:controller => 'welcome')
   end
-  
+
+  # Overrides default deliver! method to prevent from sending an email
+  # with no recipient, cc or bcc
+  def deliver!(mail = @mail)
+    return false if (recipients.nil? || recipients.empty?) && 
+                    (cc.nil? || cc.empty?) &&
+                    (bcc.nil? || bcc.empty?)
+    super
+  end
+
   private
   def initialize_defaults(method_name)
     super