Skip to content

Commit

Permalink
Merge pull request #1503 from mikel/bugfix/mime-version-capitalisation
Browse files Browse the repository at this point in the history
Update MIME-Version to have correct case per the RFC
  • Loading branch information
mikel authored Nov 30, 2022
2 parents 6c43c9b + 2191975 commit f249113
Show file tree
Hide file tree
Showing 52 changed files with 65 additions and 58 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Breaking changes:

Compatibility:

* Update MIME-Version to have correct case per RFC 2045 @mikel

Features:

* Updated README to improve around sending multipart mail @kapfenho
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ From: Mikel Lindsaar <[email protected]>
To: [email protected]
Message-ID: <[email protected]>
Subject: First multipart email sent with Mail
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary=\"--==_mimepart_626835f733867_10873fdfa3c2ffd494636\";
charset=UTF-8
Expand Down
2 changes: 1 addition & 1 deletion lib/mail/fields/mime_version_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

module Mail
class MimeVersionField < NamedStructuredField #:nodoc:
NAME = 'Mime-Version'
NAME = 'MIME-Version'

def self.singular?
true
Expand Down
2 changes: 1 addition & 1 deletion lib/mail/header.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def has_date?

# Returns true if the header has a MIME version defined (empty or not)
def has_mime_version?
fields.has_field? 'Mime-Version'
fields.has_field? 'MIME-Version'
end

private
Expand Down
2 changes: 1 addition & 1 deletion lib/mail/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,7 @@ def has_date?
header.has_date?
end

# Returns true if the message has a Mime-Version field, the field may or may
# Returns true if the message has a MIME-Version field, the field may or may
# not have a value, but the field exists or not.
def has_mime_version?
header.has_mime_version?
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/attachments/basic_email.eml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ From: Mikel Lindsaar <[email protected]>
To: Mikel Lindsaar <[email protected]>
Content-Type: text/plain; charset=US-ASCII; format=flowed
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (Apple Message framework v929.2)
MIME-Version: 1.0 (Apple Message framework v929.2)
Subject: Testing 123
Date: Sat, 22 Nov 2008 15:04:59 +1100
X-Mailer: Apple Mail (2.929.2)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Mime-Version: 1.0 (Apple Message framework v730)
MIME-Version: 1.0 (Apple Message framework v730)
Content-Type: multipart/mixed; boundary=Apple-Mail-13-196941151
Message-Id: <[email protected]>
From: [email protected]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Mime-Version: 1.0 (Apple Message framework v730)
MIME-Version: 1.0 (Apple Message framework v730)
Content-Type: multipart/mixed; boundary=Apple-Mail-13-196941151
Message-Id: <[email protected]>
From: [email protected]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Mime-Version: 1.0 (Apple Message framework v730)
MIME-Version: 1.0 (Apple Message framework v730)
Content-Type: multipart/mixed; boundary=Apple-Mail-13-196941151
Message-Id: <[email protected]>
From: [email protected]
Expand Down Expand Up @@ -52,7 +52,7 @@ From: Test Tester <[email protected]>
Reply-To: Test Tester <[email protected]>
To: [email protected], [email protected]
Subject: Another PDF
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_2192_32400445.1115745999735"
X-Virus-Scanned: amavisd-new at textdrive.com
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Mime-Version: 1.0 (Apple Message framework v730)
MIME-Version: 1.0 (Apple Message framework v730)
Content-Type: multipart/mixed; boundary=Apple-Mail-13-196941151
Message-Id: <[email protected]>
From: [email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Content-Disposition: attachment; filename=blah.gz
Content-Transfer-Encoding: base64
Content-Description: Attachment has identical content to above foo.gz
Message-Id: <1066974048.4264.62.camel@localhost>
Mime-Version: 1.0
MIME-Version: 1.0
Date: 23 Oct 2003 22:40:49 -0700
Content-Type: application/x-gzip; NAME=blah.gz

Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/emails/attachment_emails/attachment_pdf.eml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ From: Test Tester <[email protected]>
Reply-To: Test Tester <[email protected]>
To: [email protected], [email protected]
Subject: Another PDF with 🎉 Unicode chars in it 🍿
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_2192_32400445.1115745999735"
X-Virus-Scanned: amavisd-new at textdrive.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ From: Test Tester <[email protected]>
Reply-To: Test Tester <[email protected]>
To: [email protected], [email protected]
Subject: Another PDF with 🎉 Unicode chars in it 🍿
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_2192_32400445.1115745999735"
X-Virus-Scanned: amavisd-new at textdrive.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Reply-To: xxxxxxxxx xxxxxxx <[email protected]>
To: xxxxx xxxx <[email protected]>
Subject: Fwd: Signed email causes file attachments
In-Reply-To: <[email protected]>
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_5028_7368284.1115579351471"
References: <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Reply-To: xxxxxxxxx xxxxxxx <[email protected]>
To: xxxxx xxxx <[email protected]>
Subject: Fwd: Signed email causes file attachments
In-Reply-To: <[email protected]>
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_5028_7368284.1115579351471"
References: <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Message-Id: <[email protected]>
From: Jeffrey Hardy <[email protected]>
To: Jeffrey Hardy <[email protected]>
Content-Type: multipart/mixed; boundary=Apple-Mail-6--218366681
Mime-Version: 1.0 (Apple Message framework v935.3)
MIME-Version: 1.0 (Apple Message framework v935.3)
Subject: =?ISO-8859-1?Q?Eelanal=FC=FCsi_p=E4ring?=
Date: Wed, 13 May 2009 11:42:01 -0400
X-Mailer: Apple Mail (2.935.3)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Mime-Version: 1.0 (Apple Message framework v730)
MIME-Version: 1.0 (Apple Message framework v730)
Content-Type: multipart/mixed; boundary=Apple-Mail-13-196941151
Message-Id: <[email protected]>
From: [email protected]
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/emails/error_emails/cant_parse_from.eml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ From: Apple <[email protected]>
To: [email protected]
Message-Id: <7oh6b1$[email protected]>
Subject: Meet the new MacBook Pro family. Now includes 13-inch.
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary=mimepart_4b0c353551675_3d1c15b79ea5e70c1783


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Received: from LIST.TRANSMISSION.BPA.GOV by LIST.TRANSMISSION.BPA.GOV
Received: from [207.202.136.216] (ip136.r2.d.pdx.nwlink.com [207.202.136.136])
by comet.pacifier.com (8.11.2/8.11.1) with ESMTP id g0ALxLX06696;
Thu, 10 Jan 2002 13:59:21 -0800 (PST)
Mime-Version: 1.0
MIME-Version: 1.0
X-Sender: [email protected]
References: <1168BAF252B7D41194810001028D743108913C@SERVER>
Content-Type: multipart/mixed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To: [email protected],
[email protected]
Message-Id: <[email protected]>
Subject: [Online Lead] Online Lead #1111111
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/emails/mime_emails/raw_email11.eml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
From [email protected] Wed Apr 27 14:15:31 2005
Mime-Version: 1.0 (Apple Message framework v619.2)
MIME-Version: 1.0 (Apple Message framework v619.2)
To: "xxxxx@xxxxx" <matmail>
Message-Id: <416eaebec6d333ec6939eaf8a7d80724@xxxxx>
Content-Type: multipart/alternative;
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/emails/mime_emails/raw_email12.eml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Mime-Version: 1.0 (Apple Message framework v730)
MIME-Version: 1.0 (Apple Message framework v730)
Content-Type: multipart/mixed; boundary=Apple-Mail-13-196941151
Message-Id: <[email protected]>
From: [email protected]
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/emails/mime_emails/raw_email2.eml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Reply-To: xxxxxxxxx xxxxxxx <[email protected]>
To: xxxxx xxxx <[email protected]>
Subject: Fwd: Signed email causes file attachments
In-Reply-To: <[email protected]>
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_5028_7368284.1115579351471"
References: <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/emails/mime_emails/raw_email4.eml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ From: [email protected]
To: [email protected]
Message-Id: <[email protected]>
Subject: Filth
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=mimepart_427e4cb4ca329_133ae40413c81ef
X-Mms-Priority: 1
X-Mms-Transaction-Id: 3198421808-0
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/emails/mime_emails/raw_email7.eml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Mime-Version: 1.0 (Apple Message framework v730)
MIME-Version: 1.0 (Apple Message framework v730)
Content-Type: multipart/mixed; boundary=Apple-Mail-13-196941151
Message-Id: <[email protected]>
From: [email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ From: Gmail Team <[email protected]>
Reply-To: [email protected]
To: =?ISO-8859-1?Q?Nicolas_Fouch=E9?= <[email protected]>
Subject: =?ISO-8859-1?Q?Nicolas_Fouch=E9_has_accepted_your_invitation_to_Gmail?=
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_976_15222032.1119945731186"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To: [email protected]
Message-Id: <009601c813c6$19df3510$0437d30a@mikel091a>
Subject: Testing outlook
Subject: Another PDF
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary=----=_Part_13069834_15179892.1376435426074

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Reply-To: Mikel Lindsaar <[email protected]>
To: [email protected]
Message-Id: <009601c813c6$19df3510$0437d30a@mikel091a>
Subject: Testing outlook
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary=----=_NextPart_000_0093_01C81419.EB75E850
X-Get_mail_default: [email protected]
X-Priority: 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To: [email protected]
Message-Id: <009601c813c6$19df3510$0437d30a@mikel091a>
Subject: Testing outlook
Subject: Another PDF
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_2192_32400445.1115745999735"
X-Virus-Scanned: amavisd-new at textdrive.com
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
From [email protected] Thu Feb 22 11:20:31 2007
Mime-Version: 1.0 (Apple Message framework v752.3)
MIME-Version: 1.0 (Apple Message framework v752.3)
Message-Id: <[email protected]>
Content-Type: multipart/signed;
micalg=sha1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Reply-To: Mikel Lindsaar <[email protected]>
To: [email protected]
Message-Id: <009601c813c6$19df3510$0437d30a@mikel091a>
Subject: Testing outlook
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----=_NextPart_000_0093_01C81419.EB75E850"
X-Get_mail_default: [email protected]
X-Priority: 3
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/emails/mime_emails/sig_only_email.eml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ From: Test <[email protected]>
To: Mikel <[email protected]>
Subject: Re: Testing multipart/signed
Message-ID: <20070604150131.40d4fa1e@reforged>
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/signed; boundary=Sig_2GIY2xfzqSADMmu9sKGJqWm;
protocol="application/pgp-signature"; micalg=PGP-SHA1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Content-Type: multipart/mixed; boundary=Apple-Mail-6--589811753
Message-Id: <[email protected]>
Date: Fri, 30 Oct 2009 19:11:02 +1100
To: Mikel Lindsaar <[email protected]>
Mime-Version: 1.0 (Apple Message framework v1076)
MIME-Version: 1.0 (Apple Message framework v1076)
X-Mailer: Apple Mail (2.1076)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Received: from blah.com (snooki [10.12.126.68])
for <[email protected]>; Tue, 29 Jun 2010 15:42:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=blah.com;
s=2010; t=1277826145; bh=wC3hHAhQgApcTmwQsi2F4OJf40rbyIek/WwIuzSc3V
M=; h=Date:From:Reply-To:To:Message-ID:Subject:Mime-Version:
M=; h=Date:From:Reply-To:To:Message-ID:Subject:MIME-Version:
Content-Type:Content-Transfer-Encoding:List-Unsubscribe; b=aw+Bhd8
t1goZUXWBAHSrHaM1IdqhkXqF5WVMwGRYcnya4FHNw05XfpB3TTpTFda13DfhtziFRk
zHSfiNbMapv7Vz+D3A/9NHg5nKahSMosZVTa0BfajYWNd1aY8JUWUlxdQHxQQ4ygCBj
Expand All @@ -69,7 +69,7 @@ Reply-To: HomeRun <[email protected]>
To: [email protected]
Message-ID: <[email protected]>
Subject: Your Friend F M wants you to join HomeRun
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="--==_mimepart_4c2a146141756_61ff157c4ec1649a8";
charset=UTF-8
Expand All @@ -80,7 +80,7 @@ List-Unsubscribe: <mailto:[email protected]>
----==_mimepart_4c2a146141756_61ff157c4ec1649a8
Date: Tue, 29 Jun 2010 15:42:25 +0000
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: base64
Expand All @@ -93,7 +93,7 @@ dC4sIFNhbiBGcmFuY2lzY28sIENBLCA5NDEyMywgVVNB
----==_mimepart_4c2a146141756_61ff157c4ec1649a8
Date: Tue, 29 Jun 2010 15:42:25 +0000
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: base64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Resent-Date: Mon, 24 Dec 2007 10:03:47 +1100
Date: Mon, 24 Dec 2007 10:03:47 +1100
Resent-Message-Id: <[email protected]>
Message-Id: <[email protected]>
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/report;
report-type=delivery-status;
boundary=80874BE0-2DFF-4BCB-8AA1-A00E17ACA2EA
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/emails/plain_emails/basic_email.eml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ From: Mikel Lindsaar <[email protected]>
To: Mikel Lindsaar <[email protected]>
Content-Type: text/plain; charset=US-ASCII; format=flowed
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (Apple Message framework v929.2)
MIME-Version: 1.0 (Apple Message framework v929.2)
Subject: Testing 123
Date: Sat, 22 Nov 2008 15:04:59 +1100
X-Mailer: Apple Mail (2.929.2)
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/emails/plain_emails/basic_email_lf.eml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ From: Mikel Lindsaar <[email protected]>
To: Mikel Lindsaar <[email protected]>
Content-Type: text/plain; charset=US-ASCII; format=flowed
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (Apple Message framework v929.2)
MIME-Version: 1.0 (Apple Message framework v929.2)
Subject: Testing 123
Date: Sat, 22 Nov 2008 15:04:59 +1100
X-Mailer: Apple Mail (2.929.2)
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/emails/plain_emails/raw_email.eml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
From [email protected] Mon May 2 16:07:05 2005
Mime-Version: 1.0 (Apple Message framework v622)
MIME-Version: 1.0 (Apple Message framework v622)
Content-Transfer-Encoding: base64
Message-Id: <[email protected]>
Content-Type: text/plain;
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/emails/plain_emails/raw_email8.eml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Reply-To: xxxxxxxxx xxxxxxx <[email protected]>
To: xxxxx xxxx <[email protected]>
Subject: Fwd: Signed email causes file attachments
In-Reply-To: <[email protected]>
Mime-Version: 1.0
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_5028_7368284.1115579351471"
References: <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
From [email protected] Mon May 2 16:07:05 2005
Mime-Version: 1.0 (Apple Message framework v622)
MIME-Version: 1.0 (Apple Message framework v622)
Content-Transfer-Encoding: base64
Message-Id: <d3b8cf8e49f0448085@0c28713a1@[email protected]>
Content-Type: text/plain;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Mime-Version: 1.0 (Apple Message framework v730)
MIME-Version: 1.0 (Apple Message framework v730)
Message-Id: <[email protected]>
From: [email protected]
Subject: testing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
From [email protected] Mon May 2 16:07:05 2005
Mime-Version: 1.0 (Apple Message framework v622)
MIME-Version: 1.0 (Apple Message framework v622)
Received: from jsj1wlrmd001.webex.com (by jsj1wlrmd001.webex.com
(8.12.10/8.12.11) with ESMTP id m8MKKPTs022429
for <[email protected]>; Mon, 22 Sep 2008 20:20:25 GMT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ From: Mikel Lindsaar <[email protected]>, [email protected]
To: [email protected], Mikel@Lindsaar <[email protected]>, [email protected]
Content-Type: text/plain; charset=US-ASCII; format=flowed
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (Apple Message framework v929.2)
MIME-Version: 1.0 (Apple Message framework v929.2)
Subject: Testing 123
Date: Sat, 22 Nov 2008 15:04:59 +1100
X-Mailer: Apple Mail (2.929.2)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
From [email protected] Mon May 2 16:07:05 2005
Mime-Version: 1.0 (Apple Message framework v622)
MIME-Version: 1.0 (Apple Message framework v622)
Content-Transfer-Encoding: base64
Message-Id: <[email protected]>
Content-Type: text/plain;
Expand Down
Loading

0 comments on commit f249113

Please sign in to comment.