“Reply As Original Recipient” Thunderbird Extension

GitHub repository: https://github.com/qiqitori/reply_as_original_recipient

URL: https://addons.mozilla.org/en-US/thunderbird/addon/reply-as-original-recipient/ 

This Thunderbird extension automatically changes the From: field in replies to whatever the original sender’s email had in To:, but only if there is a + in the email address (and there is only one address in To:).

URL: https://addons.mozilla.org/ja/thunderbird/addon/reply-as-original-recipient/ 

返信の時、受信したメールの「宛先」に入っているメールアドレスを返信の送信元に設定してくれるThunderbirdアドオンを作ってみました。
(ただし、仕様上、宛先のメールアドレスに「+」が入っていないと動作しません。メールアドレスが二つ以上入っている場合も動作しません。)

URL: https://addons.mozilla.org/de-DE/thunderbird/addon/reply-as-original-recipient/ 

Mit diesem Thunderbird-Addon wird bei Antworten auf angekommene Emails, die im “An:”-Feld eine Email-Adresse mit einem “+” enthalten, das “Von:”-Feld automatisch auf jene “An:”-Email-Adresse gesetzt. Allerdings funktioniert dies nur bei Emails, die nur einen “An:”-Empfänger haben.

2017-01-29 edit: 1.1 beta version: reply_as_original_recipient-1.1-tb.xpi
This version adds an option in the config editor that allows the extension to work even if there is no plus character in the To: address. The option is at “extensions.replyasoriginalrecipient.use_plus”. The default is true, meaning that the address has to contain a plus character.

31 thoughts on ““Reply As Original Recipient” Thunderbird Extension”

  1. Thanks a lot! This is really helpful to have when your email provider features the “+” syntax for dynamic aliases, and allows to send emails from arbitrary aliases as well. Only email provider I know which does that is mailbox.org.

  2. Version 1.1 doesn’t work correctly if you are in CC

    I got an email as copy but when I reply it adds the email of the original To as new sender, which is totally nonsense.

    I never want to send as someone else, I only want the addon to select the right one of my accounts to send from.

    Solution would be:

    if the address in CC matches one of my accounts then use that one, only otherwise use the oritinal To address as sender.

  3. I now downloaded the xpi file for 1.0, unpacked it in a folder and edited the line that checks rot the “+”. I replaced it with my email catch-all-domain, so only if that domain is in the TO: field, it will use that as sender email.

    then I repacked it with

    cd ~/extensions/my_extensions
    zip -r ../sample.xpi *

    that new xpi file works fine with only my domain instead of the check for “+” ;)

    I think this is what most people need it for, so just make that “+” string configurable in the next version.

  4. Thanks for this extension.

    Could it be possible to check if there is ‘Delivered-To’ field and then use it instead of ‘To’ field. It would be useful for email received from mailing-list.

    1. Hey, sorry for taking ages to get back to you. Does the following plugin do what you need?
      https://addons.mozilla.org/en-US/thunderbird/addon/correct-identity/

      Edit:
      I checked if there is a way to get “Delivered-To” from originalHeader as defined in the code below, by trying (among other things) originalHeader.getStringProperty(“Delivered-To”), but nothing worked. Sorry. If you know of an extension that uses “Delivered-To” somewhere, I could borrow some code from there.

      /* Get original recipient */
      originalHeader = this.getMessageHeaderFromURI(gMsgCompose.originalMsgURI);
      originalRecipient = originalHeader.mime2DecodedRecipients;

      1. I have to support Qiqitori on this one:
        The only way to get to those headers is using an ID to get an InputStream of the local stored message, than reading the raw data parsing the Headers manualy.
        Without an existing function this is totally out of the scope of this extension (would take 10 times as much code, not to mention the amount of testing till it is stable)

  5. Could it be possible to configure the separator? gmail uses ‘+’, but some other systems use ‘-‘. The exim mail software allows admins to configure whatever they want.

    It would actually be cool to be able to set a pattern to match the recipient so I could match on domain. I want to match hamish-foo@mydomain only, if I receive an email to some-list@domain.com I don’t want to reply as some-list@domain.com just because that matches the dash.

  6. Thank you so much for the 1.1-beta version! This is almost exactly what I need.

    The only problem I notice, is that replying to messages sent to “undisclosed-recipients:” use that as a From :-p

    I don’t know if you can read it in an extension, there is _one_ place where I think you can always read the actual intended recipient name:
    In the received email headers, there are a number of “Received: from … by … id … for …”, and the _last_ “for” gives the actual intended recipient, even if BCC ;-)

    Cheers!

  7. Note: Delivered-To is _not_ the address to seek. In most cases, when receiving an email to an alias, you will see:

    Delivered-To: real-name@example.org
    Received: from … by your-server id … for real-name@example.org
    Received: from … by your-server id … for alias@example.org

    Thus my suggestion to use Received rather than Delivered-To.

    That being said, if reading the headers is impossible, as suggested in #comment-6495 then being able to match a pattern in both To: and Cc: (for example “*@example.org”, or “name+*@gmail.com”) would be pretty nice!
    Unless I am mistaken, this is what rubo77 did in #comment-3140 ;-)

    Cheers

  8. I changed a few Lines in the beta version to address the some of the issues:

    # Multiple “To:” entries
    The extension will still work when there are multiple “To:” entries, as long as only one entry has a plus sign (or matches the patterns, see below)

    # “Cc:”
    “To:” and “Cc:” are both used to find the Recipient. This makes senece now that only exactly one match is alowed.

    # Configurable patterns:
    The option “use_plus” is replaced by “extensions.replyasoriginalrecipient.patterns”.

    ## Example of patterns:
    `name+*@gmail.com` (Thx @Yves for the idea)
    `*@example.org`
    `*+*` (the default)
    `*` (same behaviour as “use_plus” set to false in version 1.1)
    `*@example.org,*+*` (multiple patterns are separated by comma)

    The patterns are matched case insensitive against the full recipient e.g. `My Name ` as well as the email (the part between “).
    Only `*` and `,` have special meaning in the patterns option.
    Blanks at the beginning and the end are ignored.

    @Qiqitori: Thank you for the very useful extension. I temporarily [uploaded the changed xpi to my server](https://samuel-kirschner.de/reply_as_original_recipient-1.2-tb.xpi) Feel free to repost it here or even upload it to addons.thunderbird.net

    @Yves: Thanks for the pattern example. Before I read your comment I was using regex, and having ato write a pattern like `^name\+.*@gmail\.com$` is really not that convenient.

  9. Do you intend to update this plugin and the one that allows for no + in the address to be compatible with version 60 and above?

      1. The newest version of Thunderbird will not allow me to install and comes back with a message in Red saying “Reply As Original Recipient could not be installed because it is not compatible with Thunderbird 60.0”

        1. Ah. Hmm. I just tried downloading the extension from https://addons.thunderbird.net/en-US/thunderbird/addon/reply-as-original-recipient/ which seemed to work.
          Maybe they update compatibility metadata automatically?

          I don’t think I’ll be able to keep updating the metadata of the beta extension, so here’s what you have to do to change the metadata yourself:
          1) Unzip the .xpi file
          2) Open install.rdf and change em:maxVersion=”53.*” to something higher.
          3) Zip everything up again and change the file extension from .zip to .xpi

  10. does this still work for everyone else?
    it used to work for me but suddenly just stopped doing anything…
    its still installed and such, but the sender email isnt modified anymore.
    (started noticing because i was getting replies in unexpected folders… i use aliases and sieve to autosort into folders, which this extension was a heavenly help for…)

  11. Hi Qiqitori,

    I had a little time today to change two more things in the beta:

    – A small configuration dialog to enter the pattern. Including a description, but it is only in English.
    – Raising the version to 69.*, just so the beta don’t stop working. This is no meant as a stable solution.

    Could you check it out?
    ( Uploaded it to, http://samuel-kirschner.de/reply_as_original_recipient-1.3-tb.xpi )
    And maybe create a Japanese translation of the pattern-option-description.
    In case I’ll have some more time I would like to add German and Japanese language files.

    — Samuel Kirschner

    1. Hey, do you have a github account? I imported the code here: https://github.com/qiqitori/reply_as_original_recipient
      I’ve been maintaining the beta releases as separate branches. If you could send me a pull request, I could maybe import your changes a bit quicker.

      To be honest, I don’t use this extension myself and regularly forget how to test it. In order to publish an actual new release, the extension should by default do exactly what it did in the currently published version. (If your changes don’t break anything I think we could publish.)

      1. for me the extension (every version i tested) has stopped working…
        i use thunderbird daily (60.2.1) and was using it for aliases WITHOUT the + attribute.
        it worked perfectly (and i thank you for that), but now it just acts as if it is not there.

        1. When uploaded as official extention, somehow mozilla has an automated process that adjusts the “maxVersion” if there are no issues.

          The beta that can be downloaded from here does not get the automated update (it is just a file, no magic there).

          I guess, if you would have opend the addon-tab in thunderbird, there would have been a hint like “addon does not work with this version of thunderbird”

          I used a “dirty trick”: I just asumed that even without modifications beta version 1.3 should be testet until version “69.*”. It is not even posible to upload a plugin that uses a not jet exiting version to addons.mozilla, but it realy helps when testing a beta :)

    2. Be carefull when using my Version 1.3!

      I added a settings-dialog to make it easier to adjust the pattern.
      It worked like a charm, but then I updated to Thunder 60, and now the “prefwindow” is just transparent. As soon as you choese “Addon Prefrences -> Reply as origial Recipiant” from the file-menu Thunderbird is completly unusable (you cant even close it) you need the task manger to killl it.

      Use `about:config` instead. untill I find a solution.

Leave a Reply

Your email address will not be published.