MailSlurp inboxes support email auto-forwarding using inbox forwarding rules. You can attach inbox forwarders to any inbox and configure rules that will forward inbound email to other email addresses based on matching fields within the email such as body, subject or sender.

Forwarder alternatives

How does inbox forwarding work?

Inbox forwarders are entities that can be attached to an inbox. There are one-way forwarders that match emails against a rulesets to determine whether the inbound message should be forwarded to a recipient associated with the forwarder. For two-way inbox proxies see the alias guide.

Inbox forwarders can have multiple rulesets. Rules use pattern matching applied to fields within an email. So for the above example a forwarder is matched on the email subject using the asterisk in as wildcard. This means inbound emails with as a subject will be forwarded by the forwarder.

Setup

Inbox forwarding is configured for each inbox using the UI or the InboxForwarderControllerApi. Each inbox forwarder takes a , and option.

Rules can match on different fields within an inbound email address:

For instance a rule using the field will match incoming email address senders against the option in the inbox forwarder. Emails that match this rule will be forwarded to the recipients listed in the rules option.

To configure rules in the MailSlurp dashboard navigate to the inbox forwarding page and create a new inbox forwarder for an inbox of your choice:

Basic example

Let's create some inboxes with MailSlurp's javascript client and attach inbox forwarding rules.

Wildcard matching

Basic wildcard pattern matching is available:

Forwarding with complex sender name

Forwarding also works with RFC 5322 email addresses that contain a sender name:

More options

For other use cases consider using email webhooks to process incoming emails and route them using your own server logic.