forwardemail / forwardemail/forwardemail.net

[feat] relay server support

Open
#339 5 comments 3 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
1.7k
Forks
203
PR merge metrics
No merged PRs in 30d

Description

## Describe the feature

Currently, forwardemail.net only supports **forwarding** to an email address in a **different** domain (the original envelope recipient is **transformed** to a **different** address). When forwarding, forwardemail.net does the usual MX lookup for the transformed destination domain and uses SMTP to send it to an appropriate server.

I want forwardemail.net to support a new operating mode: **relaying**. This is almost identical to forwarding, with the following differences:
* The envelope recipient is **unchanged**.
* Instead of performing an MX lookup on the recipient domain to find the next hop (which would cause a routing loop to itself because the envelope recipient is unchanged), forwardemail.net would use an explicitly configured server as the next hop.
* As a configurable option, forwardemail.net would use [RFC 6409](https://www.rfc-editor.org/rfc/rfc6409) message submission to port 587 or 465 instead of the usual SMTP to port 25.
* Ideally, forwardemail.net would use the [Postfix `XFORWARD` command](https://www.postfix.org/XFORWARD_README.html) when relaying a message (assuming the destination server advertises support).

I believe this feature request is a duplicate of https://github.com/forwardemail/free-email-forwarding/issues/284 which has been archived.

## Example

1. `outgoingsmtp.sender.example` → `mx1.forwardemail.net`:
1. `MAIL FROM:`
2. `RCPT TO:`
2. `mx1.forwardemail.net` → `receivingsmtp.recipient.example:587`
1. `STARTTLS`
2. `AUTH PLAIN `
3. [`XFORWARD`](https://www.postfix.org/XFORWARD_README.html) (optional, but preferred)
4. `MAIL FROM:`
5. `RCPT TO:`

The above can be achieved in Postfix with a [configuration](https://www.postfix.org/postconf.5.html) that includes something like the following in `main.cf`:

```
relay_domains = recipient.example
transport_maps = inline:{
recipient.example=relay:[receivingsmtp.recipient.example]:submission
}
smtp_tls_policy_maps = inline:{
[receivingsmtp.recipient.example]:submission=verify
}
smtp_sasl_password_maps = inline:{
[receivingsmtp.recipient.example]:submission=username:password
}
smtp_send_xforward_command = yes
```

## Motivation

This feature would make it possible to adopt forwardemail.net as a drop-in frontend for an existing MX setup. All a new customer would need to do is:

1. Sign up for forwardemail.net
2. Tell forwardemail.net to relay `recipient.example` emails to the existing `receivingsmtp.recipient.example:25` server
3. Optionally tell forwardemail.net to relay via submission as an authenticated user:
1. Create a submission-only account called `forwardemail` on `receivingsmtp.recipient.example`
2. Configure `receivingsmtp.recipient.example` to listen on port 587 (submission)
3. Update the forwardemail.net configuration to relay to `receivingsmtp.recipient.example:587` with username `forwardemail` and the appropriate password
4. Configure `receivingsmtp.recipient.example` to accept emails from forwardemail.net's mail servers (SRS should make this a no-op)
5. Optionally set up outgoing email from `*@recipient.example` to relay through forwardemail.net
6. Change MX records for `recipient.example` to return forwardemail.net's MX servers
7. Update SPF records if necessary

## Checklist
- [x] I have searched through GitHub issues for similar issues.
- [x] I have completely read through the README and documentation.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.