simple-login / app

The SimpleLogin back-end and web app
https://simplelogin.io
GNU Affero General Public License v3.0
5.15k stars 435 forks source link

Need an option to use mailbox.email as "To" header instead of the alias, when forwarding an email to the mailbox. #1928

Open ad-on-is opened 1 year ago

ad-on-is commented 1 year ago

I'm evaluating fastmail (FM), and have encountered the following issue with my setup. My DNS has three MX entries, example.com (handled by FM) and foo.example.com, bar.example.com (handled by SL)

Fastmail

Domain: example.com

Addresses: foo@example.com, bar@example.com

SimpleLogin

Mailboxes: foo@example.com), bar@example.com

Domains: foo.example.com (mailbox: foo@example.com, bar.example.com (mailbox: bar@example.com)

Here's my usecase:

When a mail is sent to something@foo.example.com, I want fastmail to use foo@esample.com as the reply-from address.

However, in fastmail, I only have two options, either using one of the default addresses, or the address the mail is sent to.

In my case I want to use the address the mail is sent to, but in this case, when I hit reply in fastmail, it wants to send the mail as something@foo.example.com instead of foo@example.com.

I managed to temporarily fix it, by adding the following to email_handler.py

# def forward_email_to_mailbox(...
    # ...
    add_or_replace_header(msg, "To", mailbox.email)

Is there any caveat to that approach? If not, could we have an option in the UI (per mailbox) to cover this case?

springcomp commented 1 year ago

Please, can you clarify you use case ? Did you really want to write esample.com instead of example.com ?

Let me rephrase:

When a mail is sent to alias something@foo.example.com, I want fastmail to use my mailbox address foo@example.com as the reply-from address.

So you want to hit reply and have SL use your real – hidden – email address instead ?

In my case I want to use the address the mail is sent to, but in this case, when I hit reply in fastmail, it wants to send the mail as from the alias something@foo.example.com instead of from my real, hidden address foo@example.com.

It appears you definitely want to disclose you real, hidden, email address when replying ? This contradicts what SL has been designed for, unfortunately.

Nothing, however, prevents you from replying and replacing the reverse-alias address with the real one from the recipient, thereby bypassing SL entirely and sending your mail from Fastmail instead.

Please, feel free to clarify If I did not understand clearly what is your use case.

ad-on-is commented 1 year ago

Yeah... esample was a typo. sorry for that.

I ditched SL and let my aliases be handled by fastmail.

Anyways.. as far as my knowledge goes, it wouldn't contradict to SL. In fact it's how SL works.

alice@gmail.com sends an email to bar@foo.example.com

SL handles that incoming email and redirects it to bob@fastmail.com (mailbox). The email headers are now, To: bar@foo.example.com and From: alice-reverse-alias@example.com

When Bob hits reply, Fastmail sets the From header to bar@foo.example.com (previous To header) and attempts to reply to Alice to her reverse-alias. But SL will refuse to handle that mail, since it doesn't allow the From header to be one of the aliases, instead it MUST be the mailbox address.

Therefore Bob has to change the From email manually to bob@fastmail.com, to be able to send the email.

SL and ProtonMail handle this automatically, by using X-SimpleLogin-Envelope-To and X-SimpleLogin-Envelope-From headers respectively. But SL and other mail services don't work together very well.

I hope this makes it more clear.