"Reply From Alias" Plugin

I’m a very experienced programmer, but I have attempted to use Mailspring’s API and sample plugin and haven’t even gotten anything at all to work.

Before I delve deeper into this madness, I’d like to ask: Is it even possible to create a plugin that does the following:

  • When opening the “Reply” window.
  • Automatically takes the email’s “X-Original-To:” (if exists) or “To:” (fallback) header field.
  • Uses that as the “From:” of your new email.

The purpose is to add Email Alias support to Mailspring, so that people can click “Reply” and be sure that it will be sent as your alias, rather than exposing your true, internal mailbox.

People have asked for this feature in the past:

If plugins can achieve this, technically, then I’d like to code it.

Hey @Bananaman,

I am not sure, of this is possible with a plugin. But maybe you want to implement it directly in the mailspring source code. The project is always open for pull requests.

Cheers Phylu

1 Like

Thanks, I forgot to update this thread with my research results.

What I found is that the “sender/from” is a dropdown which is populated directly at Compose window creation, by a query to the backend database that grabs all registered email accounts and aliases. It then selects the closest alias/account matching the original receiver address.

So I would not know how to add another alias and update that dropdown in realtime. It’s complex. It’s populated once on window creation and not afterwards.

One idea I had was that hitting Reply might be able to detect a new email address and auto-add the alias to the backend before the Compose form appears, so that the alias is found and mapped automatically.

Another idea was to add a button to the email viewer itself which appears when the alias doesn’t exist, and clicking on it would add that receiver to the aliases for that account. Then the user can add aliases before hitting Reply. That might be the best easiest idea, since directly modifying the Compose window seems very complicated.

But the codebase was so alien to me that I gave up. It wasn’t the quick fix that I’d hoped to see. There might be ways to solve the original idea of adding a button to the compose-form, or better yet an editable “from” field to create aliases on the fly (like Thunderbird can do with plugins like this), but it would require more time than I had available. Perhaps these ideas and observations helps someone else who is more motivated someday.