aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-06-06 16:47:20 +0000
committerJamis Buck <jamis@37signals.com>2005-06-06 16:47:20 +0000
commit5c2e0fe6491761ba2c55b780663d7f9ec86a62cc (patch)
tree91a5cd23301dedc6e0c8398ef30ae71b1efb2fb6
parent481d579734ac077f69fcd2db69c3dffdfd6f260a (diff)
downloadrails-5c2e0fe6491761ba2c55b780663d7f9ec86a62cc.tar.gz
rails-5c2e0fe6491761ba2c55b780663d7f9ec86a62cc.tar.bz2
rails-5c2e0fe6491761ba2c55b780663d7f9ec86a62cc.zip
Add a test case for malformed email headers
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1391 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionmailer/test/fixtures/raw_email928
-rwxr-xr-xactionmailer/test/mail_service_test.rb5
2 files changed, 33 insertions, 0 deletions
diff --git a/actionmailer/test/fixtures/raw_email9 b/actionmailer/test/fixtures/raw_email9
new file mode 100644
index 0000000000..8b9b1eaa04
--- /dev/null
+++ b/actionmailer/test/fixtures/raw_email9
@@ -0,0 +1,28 @@
+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" <xxx@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/mail_service_test.rb b/actionmailer/test/mail_service_test.rb
index 48fe0941bb..9ed2cd2293 100755
--- a/actionmailer/test/mail_service_test.rb
+++ b/actionmailer/test/mail_service_test.rb
@@ -510,5 +510,10 @@ EOF
attachment = mail.attachments.last
assert_equal "01QuienTeDijat.Pitbull.mp3", attachment.original_filename
end
+
+ def test_wrong_mail_header
+ fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email9")
+ assert_raise(TMail::SyntaxError) { TMail::Mail.parse(fixture) }
+ end
end