diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-11-15 16:56:06 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-11-15 16:56:06 +0000 |
commit | f5ced2133cd1a66e18b225208fa96f4f36a20889 (patch) | |
tree | 1401766c96e72041600f5470196c7481e746c4b0 /lib/mail_handler/backends/tmail_extensions.rb | |
parent | 1e8083fe07483d7111530886a6c09cb3325aa53f (diff) |
Move address_from_name_and_email to mail handler.
Diffstat (limited to 'lib/mail_handler/backends/tmail_extensions.rb')
-rw-r--r-- | lib/mail_handler/backends/tmail_extensions.rb | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/lib/mail_handler/backends/tmail_extensions.rb b/lib/mail_handler/backends/tmail_extensions.rb index bc994b9f3..9359dfeea 100644 --- a/lib/mail_handler/backends/tmail_extensions.rb +++ b/lib/mail_handler/backends/tmail_extensions.rb @@ -74,22 +74,6 @@ module TMail end - class Address - # Monkeypatch! Constructor which makes a TMail::Address given - # a name and an email - def Address.address_from_name_and_email(name, email) - if !MySociety::Validate.is_valid_email(email) - raise "invalid email " + email + " passed to address_from_name_and_email" - end - if name.nil? - return TMail::Address.parse(email) - end - # Botch an always quoted RFC address, then parse it - name = name.gsub(/(["\\])/, "\\\\\\1") - return TMail::Address.parse('"' + name + '" <' + email + '>') - end - end - module TextUtils # Monkeypatch! Much more aggressive list of characters to cause quoting # than in normal TMail. e.g. Have found real cases where @ needs quoting. @@ -101,8 +85,8 @@ module TMail end end -# Monkeypatch! TMail 1.2.7.1 will parse only one address out of a list of addresses with -# unquoted display parts https://github.com/mikel/tmail/issues#issue/9 - this monkeypatch +# Monkeypatch! TMail 1.2.7.1 will parse only one address out of a list of addresses with +# unquoted display parts https://github.com/mikel/tmail/issues#issue/9 - this monkeypatch # fixes this issue. module TMail |