“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.

54 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. Just a very simple question from a noob: how do I get to that config editor where I can change the criteria?

    1. Hi,
      Edit -> Preferences -> Advanced -> Config Editor
      (If you can’t see the Edit menu, try pressing Alt + E)

  11. 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…)

  12. 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.

  13. I took this extension and changed it a little further. The one thing I’ve changed is how the original e-mail address is set to the sender field. The previous code always used the entire text, including name and address. This makes me look like the sender named me. If that includes misspellings and other crap, that would be the sender name of my message. If the sender didn’t know my name and only entered the address alone, I would send my message without a name, too.

    My change now only applies the original recipient e-mail address but leaves the account name.

    Example:

    My account configuration: My Name
    Somebody sent me a message to: xyz
    My sender (previous version): xyz
    My sender (modified): My Name

    This looks more friendly to the recipient of my reply and makes sure I am recognised by my name.

    I call it version 1.4. It is based on 1.2. The number 1.3 was already used but declared broken so I skipped it.

    Here’s the archive: https://unclassified.de/tmp/reply_as_original_recipient-1.4-tb.zip (Rename to .xpi; if I did it, you couldn’t download the file with Firefox)

    1. Oh, my coment was mangled by the blog. Here’s the part with the senders, using different characters:

      My account configuration: My Name (my.name@example.com)
      Somebody sent me a message to: xyz (my.alias@example.com)
      My sender (previous version): xyz (my.alias@example.com)
      My sender (modified): My Name (my.alias@example.com)

  14. hi…
    my ‘reply-to sender only’ not functioning, after I removed the add-on…

    how do I reinstate it…?

  15. Following the example of Samuel, I just created a pull request at https://github.com/qiqitori/reply_as_original_recipient/pull/5 to incorporate the changes mentioned here in the comments. It works fine in TB 68 and the configuration preference is great as I want every reply to look for the “From” header of the preceding message. A big “thank you” to everyone!

    I was a bit disappointed as the extension “Virtual Identity” ceased to work because of the update to TB 68, but then I found this extension which is much more lightweight and seems to do the job as good as my previous solution.

  16. Yves, thank you for putting time and work into this. I really depend on this extension and have updated Thunderbird to 68.3.1. I’m keeping my fingers crossed and going to try your 1.5 update now. Thank you again. If I can help with any future testing to keep this extension alive, I’d be happy to help.

    1. Yves, just a quick update. I have been using your 1.5 update with Thunderbird 68.3.1 for a few days and so far, for me, it’s working great. So thanks again! To be clear, I have not tested all aspects of it. I simply always want the recipient address populated to the sender address of my reply (no “plus” or other requirement), and that works. Happy holidays!

  17. I am using TB 68.5.0 and just installed this extension (1.5) for the first time. I can’t seem to get it to work for me. Can someone please confirm? Would love to know if it’s just me or the extension.

  18. Thanks for the quick work. Unfortunately, after changing zip file to xpi extension, it would not install. Keep getting the dreaded: This add-on could not be installed . . . not compatible with Thunderbird 68.5.0.

  19. Success . . the version in the link you just provided worked for me. I retried all the steps and this time everything worked right away. Thanks again for the quick work to get this out – – great support.

  20. The latest commit in the github repo, from feb 2020, works perfectly (at least in Thunderbird 68.9.0 64-bit)!

    Many thanks for this excellent add-on, I’ve been using a catch-all address in all of my domains since forever and have been very annoyed at having to manually edit the from-address every time I needed to. No more! Happy days are here again! :)

    I must however admit that it took a number of failed attempts, with Thunderbird refusing due to supposed incompatibility with 68+, to realize that Thunderbird requires the (manifest) files to be in the root of the zip/xpi though. I first had them in a sub folder, as they come when using regular download from github instead of using git.

  21. I am very interested in this plugin because I use a catch-all e-mail domain, receive e-mails with various usernames “@mydomain.com” in the “To” field and would like to reply with the same e-mail address in the “From” field of my reply.

    But the plugin refuses to be installed because it “… is incompatible with Tunderbird 78.6.0”. Even if I install it manually by cloning the GitHub repository and creating the .xpi file, it gets deactivated after the next restart.

    Any chance this plugin will be adapted to be compatible with Thunderbird 78.6.0 (64-bit)?

  22. I just wanted to say thanks this addon is the reason I have used thunderbird all these years. Thanks every who makes this possible.

Leave a Reply

Your email address will not be published.