Skip to content

[feat] relay server support #339

Open
@rhansen

Description

@rhansen

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 message submission to port 587 or 465 instead of the usual SMTP to port 25.
  • Ideally, forwardemail.net would use the Postfix XFORWARD command when relaying a message (assuming the destination server advertises support).

I believe this feature request is a duplicate of forwardemail/free-email-forwarding#284 which has been archived.

Example

  1. outgoingsmtp.sender.examplemx1.forwardemail.net:
    1. MAIL FROM:<[email protected]>
    2. RCPT TO:<[email protected]>
  2. mx1.forwardemail.netreceivingsmtp.recipient.example:587
    1. STARTTLS
    2. AUTH PLAIN <base64>
    3. XFORWARD (optional, but preferred)
    4. MAIL FROM:<[email protected]>
    5. RCPT TO:<[email protected]>

The above can be achieved in Postfix with a configuration 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

  • I have searched through GitHub issues for similar issues.
  • I have completely read through the README and documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions