Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[PATCH] Remove quote_fields from ActionMailer

#4294

This bug happened only when there're multibyte chars in subject and the length of quoted subject is more than 40, ActionMailer and Mail gem will quote the subject twice and make it garbled.

For example, if I set mail's subject to a multibyte string like: "\350\277\231\346\230\257\344\270\200\344\270\252\351\202\256\344\273\266\346", ActionMailer will quote the subject to:

Subject: =?UTF8?B?5oKo5Yia5Yia5Zyo5oqi5bqn572R5Yib5bu65LqG5AuIDkuKrmlrDmtLvliqgh?=

and Mail gem will quote and fold it again, because it's all ASCII char now, Mail gem will fold it only, so it becames:

Subject: =?UTF8?B?5oKo5Yia5Yia5Zyo5oqi5bqn572R5Yib5bu65LqG5A
    uIDkuKrmlrDmtLvliqgh?=

but it should be:

Subject: =?UTF8?B?5oKo5Yia5Yia5Zyo5oqi5bqn572R5Yib5bu65LqG5A==?=
    =?UTF8?B?uIDkuKrmlrDmtLvliqgh?=

so the mail subject is garbled in mailbox.

This patch will move quote_fields! to old_api and add a test to ensure ActionMailer won't quote header fields anymore.

Reported by yuanyi · March 29th, 2010 @ 06:07 PM

State: resolved
Milestone: 3.0.2
Assigned to: Mikel Lindsaar Mikel Lindsaar
Importance: Low

Activity

  1. José Valim
    José Valim
    • Assigned user set to Mikel Lindsaar
    • Milestone cleared.

    Thanks for patch! I guess Mikel is already working on it so I'm assigning it to him.

    March 29th, 2010 @ 07:41 PM

  2. Mikel Lindsaar
    Mikel Lindsaar

    Yes, I am working on this and while the above patch "works" unfortunately there are a lot of edge cases where it doesn't and the ActionMailer test suite does not cover these.

    Mail 2.2 should address this problem in header encoding, once I know this is good, I'll be doing something similar to this.

    Mikel

    March 29th, 2010 @ 09:45 PM

  3. Yehuda Katz (wycats)
    Yehuda Katz (wycats)
    • State changed from new to hold

    March 29th, 2010 @ 09:47 PM

  4. Mikel Lindsaar
    Mikel Lindsaar

    Working on this today and tonight. Should have new version of mail shortly that handles this stuff.

    March 30th, 2010 @ 01:26 PM

  5. Mikel Lindsaar
    Mikel Lindsaar
    • State changed from hold to open

    Mail new version is giving: 196 tests, 439 assertions, 13 failures, 6 errors in ActionMailer. Will take me a little time to make sure this is all correct. Should be able to submit full patch to ActionMailer shortly, some of the old tests rely on quoting.rb and I want to nuke it, so am going to refactor.

    March 31st, 2010 @ 01:09 PM

  6. Mikel Lindsaar
    Mikel Lindsaar
    • State changed from open to resolved

    This is now rolled into core by these commits

    Mikel

    April 20th, 2010 @ 05:49 AM

  7. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to Low

    October 15th, 2010 @ 11:01 PM