Last Comment Bug 655428 - "Reply with Template" Filter replies to From field, not Reply-To field
: "Reply with Template" Filter replies to From field, not Reply-To field
Product: MailNews Core
Classification: Components
Component: Filters (show other bugs)
: unspecified
: x86 Windows XP
-- normal with 3 votes (vote)
: Thunderbird 22.0
Assigned To: Kent James (:rkent)
: 837833 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2011-05-06 18:52 PDT by pete
Modified: 2013-09-02 11:08 PDT (History)
8 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---

Add default imap Reply-To header (1.21 KB, patch)
2013-02-12 12:24 PST, Kent James (:rkent)
irving: review+
Details | Diff | Splinter Review

Description User image pete 2011-05-06 18:52:15 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20110420 Firefox/3.6.17 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10

In Mail Filters, a ""Reply with Template" action replies to the From field in the incoming mail header, instead of the "Reply-To" field. There is no way to specifically select to use either one, and it, incorrectly I believe, replies to the sender.

This has been causing me a problem in this example:
I often get emails from an auction site, for example, that informs me of a winning bid. It sends the email to me, on the sellers behalf, so I can hit reply to the seller directly because the sellers email is in the Reply-To field. My "Reply with Template" filter is set to automatically send my contact details to the seller...or so I thought. It ends up replying back to the auction mailbot, not the seller.

Reproducible: Always

Steps to Reproduce:
1. Set up a "Reply with Template" filter
2. Receive an email from an account that has a different Reply-To address than the sender

Actual Results:  
The filter action sends the template to the sender.

Expected Results:  
The filter action should send the template to the email address(es) in the Reply-To field in the incoming mail header.
Comment 1 User image Wayne Mery (:wsmwk, NI for questions) 2011-05-18 05:36:51 PDT
Comment 2 User image 1001bricks 2012-05-13 07:57:29 PDT
Hello -

I have the same problem, and for a shop in a Venue... it's annoying.

Using this kind of procedure:

... TB sends the template email to the From address (the Venue), and NOT the Reply-To address (the Buyer).

I'd like to add it worked with no problem for 2 years at least, using the same account/configuration but in POP3.
It doesn't work correctly since we very recently swapped to IMAP.

I tried it again today, and still doesn't work.
v.12.0.1, released: April 30, 2012

Thanks in advance !
Comment 3 User image sales 2013-02-03 10:33:03 PST
I am having the same problem and I'm hoping to revive this request.  Can anybody recommend a solution or come up with a fix for IMAP (can not use POP).  The problem is clearly described above.  The "reply with template" filter action replies to the sender, and not the "reply to" email address.

Your help would be greatly appreciated.
Comment 4 User image seawind 2013-02-10 10:20:28 PST
I would also like to revive this bug! Please help us fix this one.

It has been tested and is a problem on:

Windows XP
Windows 7
Windows 8
Comment 5 User image Kent James (:rkent) 2013-02-12 11:34:41 PST
Looking briefly at the underlying code, I am guessing without test that the "From" comes from this code in nsMsgComposeService.cpp:
949   nsCString replyTo;
950   mHdrToReplyTo->GetStringProperty("replyTo", getter_Copies(replyTo));
951   if (replyTo.IsEmpty())
952     mHdrToReplyTo->GetAuthor(getter_Copies(replyTo));

We also have this comment in nsMsgComposeService::ReplyWithTemplate:

1086   // We need the reply-to header of the msg we're replying to, so
1087   // we're going to add that to the db if it's different from "from:"
1088   // For imap, we could make adding a reply-to filter append
1089   // reply-to to the custom headers...

Looking through the protocol and parse code, it seems to me like you could follow those instructions, that is add reply-to to the preference mailnews.customDBHeaders and this should work.

I tried this, and it seemed to work for me. So just add reply-to to that preference, and see if it starts to work.

If so, then I suggest that this bug be morphed into a request to add Reply-To to the default list of headers that are downloaed for IMAP.
Comment 6 User image sales 2013-02-12 11:49:46 PST
James, thank you kindly for your suggestion.  Can you please provide a little bit more guidance as to which files to modify, and where and how?  I'm not computer illiterate, just not a programmer.

Where are the configuration files that need to be changed, and what lines do I change?
Comment 7 User image Kent James (:rkent) 2013-02-12 12:03:56 PST
In Tools/Options/Advanced/General click on "Config Editor..." and search for mailnews.customDBHeaders. Modify that so that it has the value "reply-to" (no quotes)  (if there is any existing value, then add a space followed by reply-to).
Comment 8 User image Kent James (:rkent) 2013-02-12 12:24:35 PST
Created attachment 713047 [details] [diff] [review]
Add default imap Reply-To header

Is there any reason why we can't just add reply-to to the list of IMAP headers like this?
Comment 9 User image sales 2013-02-12 16:52:24 PST
Hi James, I added "reply-to" (without quotes) in the "value" field of the config editor for the line item mailnews.customDBHeaders.

I then re-ran the rule after restarting thunderbird, and it still replied to the from address.

I'm not sure if this matters, but I am on an IMAP account.

Did I apply the proposed change incorrectly?  Thanks again.
Comment 10 User image Kent James (:rkent) 2013-02-12 17:05:29 PST
This would only work for a newly received message. For it to work on old messages, you have to rebuild (repair) the folder.
Comment 11 User image seawind 2013-02-12 17:17:24 PST
Kent James:

Thank you for the help your fix seems to work perfectly, it is greatly appreciated this will save me a lot of manual labor! Is there any way I can donate to you or the Thunderbird team somehow?


After making the change in Config Editor right click the folder that your emails you want to auto-reply are in then click "Properties..." in General Information click "Repair Folder" then try your filter.
Comment 12 User image Kent James (:rkent) 2013-02-12 19:53:33 PST
I have never accepted donations for my Mozilla work, so let's not go down that path. (Not that I am a free-as-in-beer fanatic, in fact I have been a major voice for more effective monetization of the Thunderbird project).

In theory you are supposed to be able to donate to specific projects, but looking at the page that the Mozilla website sends you to ( there is no entry for "Thunderbird". I guess that just shows how backwards we really are in monetization!

So unless one of the cc folks here have a suggestion, I guess your option is a general Mozilla foundation contribution. They continue to provide critical support for Thunderbird.
Comment 13 User image sales 2013-02-13 06:29:29 PST
You are correct.  It does work on new incoming messages.  Thank you so much, this really is a life saver for my business.  

Question: if an incoming email is received where the "reply-to" field is blank, will the filter default to the from address?


Comment 14 User image seawind 2013-02-13 08:03:11 PST
Kent James: Well if you were in the area I'd get you a 24 pack.

Jon: Yes if there is no reply-to address it defaults to the from address.
Comment 15 User image sales 2013-02-13 13:13:59 PST
James: Since you so handily solved that issue with the reply with template action, I'm wondering if you can take at one more issue with this message filter action.

The rule generated reply email contains the selected template, with a modified subject line.  It combines the subject of the selected template, and then adds (was: "origonal email subject").  Is there any way to just replace the origonal subject with that of the template, and not to append the subject?

Thank you again for your time and expertise.
Comment 16 User image Kent James (:rkent) 2013-02-19 13:05:27 PST

The "was: " portion is hard-wired in this code in nsMsgComposeService.cpp:

958   mTemplateHdr->GetMime2DecodedSubject(templateSubject);
959   mHdrToReplyTo->GetMime2DecodedSubject(replySubject);
960   if (!replySubject.IsEmpty())
961   {
962     templateSubject.Append(NS_LITERAL_STRING(" (was: "));
963     templateSubject.Append(replySubject);
964     templateSubject.Append(NS_LITERAL_STRING(")"));
965   }
966   compFields->SetSubject(templateSubject);

That's tacky, as "was:" really needs localization.

So I think that to fix this without a core code change would require a custom filter action. It could probably be approached with javascript custom action in FiltaQuilla, if not by a new custom filter action there. But that is not work that I am going to undertake as a free project.
Comment 17 User image :Irving Reid (No longer working on Firefox) 2013-02-26 13:20:41 PST
Comment on attachment 713047 [details] [diff] [review]
Add default imap Reply-To header

Review of attachment 713047 [details] [diff] [review]:

Please file a separate bug to get the "was: " string internationalized, and another one for's request to make appending the old subject optional.
Comment 18 User image Magnus Melin 2013-02-26 22:52:25 PST
I think the " (was:  )" semi standard for changing topics isn't internationalizable. But then again i don't think its that much used either... maybe we could just remove the "was:" and have only the original subject in parenthesis.
Comment 19 User image Kent James (:rkent) 2013-03-04 11:58:41 PST
Comment on attachment 713047 [details] [diff] [review]
Add default imap Reply-To header

Checked in
Comment 20 User image Magnus Melin 2013-09-01 03:55:41 PDT
*** Bug 837833 has been marked as a duplicate of this bug. ***
Comment 21 User image Magnus Melin 2013-09-01 04:00:35 PDT
I should note that using Reply-To for automatic replies is actually prohibited per 3834 

It recommends to only use Return-Path, but that's not easily accessible...
Comment 22 User image Magnus Melin 2013-09-02 11:08:14 PDT
Let's have the discussion about that in bug 335464.

Note You need to log in before you can comment on or make changes to this bug.