Created
March 27, 2011 18:55
-
-
Save dakatsuka/889469 to your computer and use it in GitHub Desktop.
ドットが連続したメールアドレスに対処するパッチ(Mail::Message.from)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
module Mail | |
class Message | |
def from_with_patch_rfc_violation | |
str = from_without_patch_rfc_violation | |
begin | |
str = str.join | |
rescue | |
str = str.to_s | |
end | |
str.scan(/^.*?([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+?)(?![a-zA-Z0-9._-]).*$/).flatten.first | |
end | |
alias_method_chain :from, :patch_rfc_violation | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment