mikel / tmail

TMail is a Ruby Email Handler.
http://tmail.rubyforge.org/
Other
73 stars 36 forks source link

Wrong adresses in headers #7

Open zuf opened 14 years ago

zuf commented 14 years ago

Hello.

I discover strange issue with TMail version 1.2.6 - 1.2.7.1. TMail adds unnecessary line breaks to headers with multiple email adresses.

For example this code:

m=TMail::Mail.new
m.to = ["a.user@example.com", "v.user2@example.com", "e.smith@example.com", "info@example.com", "v.pupkin@example.com"]
puts m.encoded

Produces string with empty lines (double line breaks: "\r\n\t\r\n\"):

=> "To: a.user@example.com,\r\n\t v.user2@example.com,\r\n\t e.smith@example.com,\r\n\t\r\n\tinfo@example.com,\r\n\t v.pupkin@example.com\r\n\r\n"

This mean end of headers part of email (and broke some clients like Outlook 2003).

TMail 1.2.3.1 produces another string: => "To: a.user@example.com, v.user2@example.com, e.smith@example.com,\r\n\tinfo@example.com, v.pupkin@example.com\r\n\r\n"

This string hasn't double line breaks in adress list.

P.S.

git bisect show me this information:

c5b9bb9e864c4aae882a68b8702a3389d2e8079a is the first bad commit
commit c5b9bb9e864c4aae882a68b8702a3389d2e8079a
Author: mikel <raasdnil@gmail.com>
Date:   Sun Aug 3 00:33:22 2008 +0000

    Update on getting tests passing.  Ready for patches now

:100644 100644 6bdcf74982a1f9c5a3faf4a7c88fc26bc7d38722 e8597730d36c49f860a9008a08e6779e89a06efe M  CHANGES
:100644 100644 e8b9ab9abcbd5481ab32362202e2f667552311b4 6e1e73ba0107c0fd0defe69c88281aedaf1252d4 M  NOTES
:040000 040000 2232eaa10b7d2dea0451e4501f329032eb449125 f4a17ab02c7b89a32630cb74e0209b3f93b4f0f4 M  ext
:040000 040000 cdba83fd6a982d04a77215da555274b66e84f09a fdf749e688299cd36d102bb102051463de805bc8 M  lib
:040000 040000 e723af64c7e60ceebede1349a59a158c59e627ca 1ee12541234a8e5817c6eb7468ea73f47c707f25 M  log
:040000 040000 7e2106036e3db4f8fd21018b8bf6427276f6d883 ef8f3c0b716b65128ad5c0d472c106885dceabd3 M  meta
:040000 040000 b1d38fd44b70fb3feef29a5c28d85834a673b4c4 14a89a5400061904f3132730816d88efd1880439 M  test
zuf commented 14 years ago

I fount that problem is in commit c5b9bb9e864c4aae882a68b8702a3389d2e8079a in files: lib/tmail/encode.rb lib/tmail/header.rb

Here the "reverse" patch (use patch -p1 -R): http://pastebin.com/XQCVJvWG

eac commented 14 years ago

This was causing quite a few complaints. Appears that Exchange 2003 can't parse these messages, resulting in them getting displaying in their raw format. Reverting c5b9bb9 does resolve this issue.

eac commented 13 years ago

The root cause was in Encode#fold_the_string. The fix is here: https://github.com/eac/tmail/commit/05940a3c9882147b090b061f7242a796515a2d1e. This commit has run in production for a month without any error reports.

blindninja commented 13 years ago

We are having the same problem. It started to happen when we upgraded Rails from 2.3.5 to 2.3.8. After reading the documentation, Rails 2.3.8 uses TMail 1.2.7 and Rails 2.3.5 uses TMail 1.2.3.

The problem is the extra line space which causes our Exchange server to not send the E-mail to everyone but to display them as raw text. I tested it on Rails 2.3.11 and it was doing the same thing.

minter commented 13 years ago

I'm running into this issue as well - it'd be good to see eac's patch pulled in.

gildegoma commented 13 years ago

I've the same problem (problem found with Outlook 2007, but also with gmail webapp). This was after an upgrade to Redmine 1.2.0 (and hence from Rails 2.3.5 to 2.3.11). For interested ones, this Integration issue with Redmine has been reported there: http://www.redmine.org/issues/8751

eac, won't you open a Pull Request to merge eac/tmail@05940a3c9882147b090b061f7242a796515a2d1e ? This issue is quite critical (unless you send to multiple recipients only in BCC field). I would appreciate a 1.2.7.2 bug fix release... instead long-term patching my production systems.