Permalink
Browse files

Addresses without a parsable email or display name still format as th…

…eir raw text.


Fixes #112
  • Loading branch information...
1 parent 9a902b3 commit 3fb6143714efa9a79be1cc47888d991e4a167bbe @jeremy jeremy committed Jan 26, 2013
Showing with 9 additions and 1 deletion.
  1. +1 −0 CHANGELOG.rdoc
  2. +3 −1 lib/mail/elements/address.rb
  3. +5 −0 spec/mail/elements/address_spec.rb
View
@@ -3,6 +3,7 @@
Features:
* Setting the html_ or text_part sets a default text/html or text/plain content type (jeremy)
* Setting the html_ or text_part to nil removes it (jeremy)
+* Addresses without a parsable email or display name still format as their raw text (jeremy)
* Close pull request 399 - Accept :ca_path and :ca_file options for SMTP delivery (ndbroadbent)
Performance:
@@ -53,8 +53,10 @@ def format
''
when display_name
[quote_phrase(display_name), "<#{address}>", format_comments].compact.join(" ")
- else
+ when address
[address, format_comments].compact.join(" ")
+ else
+ tree.text_value
end
end
@@ -126,6 +126,11 @@
a.raw.should eq result
end
+ it "should format junk addresses as raw text" do
+ junk = '<"somename@gmail.com">'
+ Mail::Address.new(junk).format.should eq junk
+ end
+
end
describe "assigning values directly" do

0 comments on commit 3fb6143

Please sign in to comment.