diff --git a/lib/tmail/core_extensions.rb b/lib/tmail/core_extensions.rb new file mode 100644 index 0000000..e501651 --- /dev/null +++ b/lib/tmail/core_extensions.rb @@ -0,0 +1,60 @@ +unless Object.respond_to?(:blank?) #:nodoc: + # Check first to see if we are in a Rails environment, no need to + # define these methods if we are + class Object + # An object is blank if it's nil, empty, or a whitespace string. + # For example, "", " ", nil, [], and {} are blank. + # + # This simplifies + # if !address.nil? && !address.empty? + # to + # if !address.blank? + def blank? + if respond_to?(:empty?) && respond_to?(:strip) + empty? or strip.empty? + elsif respond_to?(:empty?) + empty? + else + !self + end + end + end + + class NilClass #:nodoc: + def blank? + true + end + end + + class FalseClass #:nodoc: + def blank? + true + end + end + + class TrueClass #:nodoc: + def blank? + false + end + end + + class Array #:nodoc: + alias_method :blank?, :empty? + end + + class Hash #:nodoc: + alias_method :blank?, :empty? + end + + class String #:nodoc: + def blank? + empty? || strip.empty? + end + end + + class Numeric #:nodoc: + def blank? + false + end + end +end \ No newline at end of file diff --git a/test/fixtures/raw_email_with_quoted_illegal_boundary b/test/fixtures/raw_email_with_quoted_illegal_boundary new file mode 100644 index 0000000..2c4e2d5 --- /dev/null +++ b/test/fixtures/raw_email_with_quoted_illegal_boundary @@ -0,0 +1,58 @@ +From email_test@me.nowhere +Return-Path: +Received: from omta05sl.mx.bigpond.com by me.nowhere.else with ESMTP id 632BD5758 for ; Sun, 21 Oct 2007 19:38:21 +1000 +Received: from oaamta05sl.mx.bigpond.com by omta05sl.mx.bigpond.com with ESMTP id <20071021093820.HSPC16667.omta05sl.mx.bigpond.com@oaamta05sl.mx.bigpond.com> for ; Sun, 21 Oct 2007 19:38:20 +1000 +Received: from mikel091a by oaamta05sl.mx.bigpond.com with SMTP id <20071021093820.JFMT24025.oaamta05sl.mx.bigpond.com@mikel091a> for ; Sun, 21 Oct 2007 19:38:20 +1000 +Date: Sun, 21 Oct 2007 19:38:13 +1000 +From: Mikel Lindsaar +Reply-To: Mikel Lindsaar +To: mikel@me.nowhere +Message-Id: <009601c813c6$19df3510$0437d30a@mikel091a> +Subject: Testing outlook +Mime-Version: 1.0 +Content-Type: multipart/alternative; boundary="----=_NextPart_000_0093_01C81419.EB75E850" +X-Get_mail_default: mikel@me.nowhere.else +X-Priority: 3 +X-Original-To: mikel@me.nowhere +X-Mailer: Microsoft Outlook Express 6.00.2900.3138 +Delivered-To: mikel@me.nowhere +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/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000..927ac14 --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,2 @@ +require 'rubygems' +require 'ruby-debug' \ No newline at end of file