Skip to content

Configuration: Source-Based Routing ? #2000

@bertiebaggio

Description

@bertiebaggio

Is it possible to create mailboxes which accept delivery based on the message source? I had a look at docs/Configuration.md and the web interface configuration page but the examples/options seem to be tailored to receipient-based matching.

Context: I have a legacy application which requires a stack upgrade, I am in the process of compatibility testing using the approach of 'compare outputs from current stack vs new stack'. One of the outputs from the app is email, and smtp4dev has already come in handy here by obviating the need for real email delivery! However I would also like to compare emails to make sure they are unchanged too, and being able to stratify them based on source would be helpful.

I am imagining a configuration along the lines of:

{
  "ServerOptions": {
    "Mailboxes": [
      {
        "Name": "Legacy Stack",
        "Source": "legacy-stack.dev.example.org"
      },
      {
        "Name": "Modern Stack (DB v15)", 
        "Source": "p15.dev.example.org"
      },
      {
        "Name": "Modern Stack (DB v18)", 
        "Source": "p18.dev.example.org"
      }
    ]
  }
}

Where the hostname in "Source" is supplied by a well-behaved client supplying its hostname during EHLO. IP addresses could also be supported here.

There's other ways I could achieve my own objective if smtp4dev doesn't support this- either at the point of smtp4dev ingress (by patching the recipient emails in the legacy app per test instance); or egress (eg by [hopefully!] finding some identifier such as the app hostname in the emails and stratifying on that) but given the objective of smtp4dev I mention this in case it's something you'd be interested in considering?

In any case, thanks for creating something useful and easy to spin up- a good thing to have stashed in one's toolbox! I've mentioned it to a few folks already :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions