Skip to content

Instantly share code, notes, and snippets.

@dakatsuka
Created March 27, 2011 18:55
Show Gist options
  • Save dakatsuka/889469 to your computer and use it in GitHub Desktop.
Save dakatsuka/889469 to your computer and use it in GitHub Desktop.
ドットが連続したメールアドレスに対処するパッチ(Mail::Message.from)
# 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