Permalink
Browse files

Add a method to read a mail message from a string (mcansky)

Basicly it does exactly what Mail.read does already, it just take a mailfile content as input
  • Loading branch information...
1 parent 8f93ebd commit d51efbb3bd4a8e7801c27801f8fe1b4e0c0ee510 @mikel committed Sep 11, 2010
Showing with 5 additions and 0 deletions.
  1. +1 −0 CHANGELOG.rdoc
  2. +4 −0 lib/mail/mail.rb
View
@@ -6,6 +6,7 @@
* Replace hard-coded references to Mail with more generic self references to allow easier inheritance (closes #61) - Simone Carletti
* Force encoding on Regexp for Ruby 1.9 to avoid encoding conflicts - Golubev Pavel
* Added lazy evaluation to message body: body is not parsed until need. It greatly improves performance with big mails if you don't need to read the body (yet)
+* Added Mail.read_from_string as an explicit method (mcansky)
== Sat Sep 11 01:32:13 UTC 2010 Mikel Lindsaar <mikel@rubyx.com>
View
@@ -176,6 +176,10 @@ def self.delete_all(*args, &block)
retriever_method.delete_all(*args, &block)
end
+ # Instantiates a new Mail::Message using a string
+ def Mail.read_from_string(mail_as_string)
+ Mail.new(mail_as_string)
+ end
# Initialize the observers and interceptors arrays
@@delivery_notification_observers = []

0 comments on commit d51efbb

Please sign in to comment.