Permalink
Browse files

A very thorough refactoring, resulting in new mail property setters a…

…nd support for attachments and multipart messages.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1359 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 79d9794 commit 359caef33ca71b37b3ea2feef0960beccfabf4de @jamis jamis committed May 29, 2005
@@ -1,5 +1,9 @@
*SVN*
+* Support attachments and multipart messages.
+
+* Added new accessors for the various mail properties.
+
* Fix to only perform the charset conversion if a 'from' and a 'to' charset are given (make no assumptions about what the charset was) #1276 [Jamis Buck]
* Fix attachments and content-type problems #1276 [Jamis Buck]
@@ -117,4 +121,4 @@
*0.3*
-* First release
+* First release
@@ -36,11 +36,13 @@
require 'action_mailer/base'
require 'action_mailer/mail_helper'
+require 'action_mailer/quoting'
require 'action_mailer/vendor/tmail'
require 'net/smtp'
ActionView::Base.class_eval { include MailHelper }
+ActionMailer::Base.class_eval { include ActionMailer::Quoting }
old_verbose, $VERBOSE = $VERBOSE, nil
TMail::Encoder.const_set("MAX_LINE_LEN", 200)
-$VERBOSE = old_verbose
+$VERBOSE = old_verbose
@@ -0,0 +1,58 @@
+module ActionMailer
+ module AdvAttrAccessor
+ def self.append_features(base)
+ super
+ base.extend(ClassMethods)
+ end
+
+ module ClassMethods
+
+ def adv_attr_accessor(*names)
+ names.each do |name|
+ define_method("#{name}=") do |value|
+ instance_variable_set("@#{name}", value)
+ end
+
+ define_method(name) do |*parameters|
+ raise ArgumentError, "expected 0 or 1 parameters" unless parameters.length <= 1
+ if parameters.empty?
+ instance_variable_get("@#{name}")
+ else
+ instance_variable_set("@#{name}", parameters.first)
+ end
+ end
+ end
+ end
+
+ end
+ end
+end
+module ActionMailer
+ module AdvAttrAccessor
+ def self.append_features(base)
+ super
+ base.extend(ClassMethods)
+ end
+
+ module ClassMethods
+
+ def adv_attr_accessor(*names)
+ names.each do |name|
+ define_method("#{name}=") do |value|
+ instance_variable_set("@#{name}", value)
+ end
+
+ define_method(name) do |*parameters|
+ raise ArgumentError, "expected 0 or 1 parameters" unless parameters.length <= 1
+ if parameters.empty?
+ instance_variable_get("@#{name}")
+ else
+ instance_variable_set("@#{name}", parameters.first)
+ end
+ end
+ end
+ end
+
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit 359caef

Please sign in to comment.