The Definition of a Route
You can think of our Routes feature as a sophisticated filtering and forwarding mechanism. With Routes, you have a good deal of capabilities at your disposal, such as:
- Forward incoming emails to another environment for storage (such as another email address or maybe an endpoint on your server)
- Store a message temporarily (for up to 3 days) and retrieve it using our Messages API
- Stop a message from being processed (this drops certain messages instead of forwarding or storing them)
The Creation of a Route
You can set up a Route in one of two ways:
- Via the Mailgun control panel
- Via the API
For brevity's sake, we'll just cover how to set up a Route via the Control Panel in this article.
We'll show you how to do this below:
- First, log in to the Mailgun Control Panel (if you have not already done so).
- Then, within the left-hand navigation pane, click the Receiving option.
- Next, toggle the Region switch to the desired region for which you wish to create a route. It is found towards the upper-right portion of the page.
- Click the Create route button (also found towards the upper-right portion of the page).
- Enter the information for the Expression Type, Actions, Priority, and Description field.
- Click on the Create Route button to save the route.
The Features Of A Route
The first thing you will see is the Expression Type dropdown menu. This consists of the following expressions:
- Catch All - Gives you a way to catch the incoming messages for which you've not made a specific Route
- Match Recipient - This will filter any incoming messages that match a specific email address, such as firstname.lastname@example.org (where mail.example.com is the domain verified on your account)
- Match Headers - Similar to Match Recipient, this will filter incoming messages based on a header in the message, such as any message with the word "support" in the subject line
- Custom - Custom routes are a little more advanced; this is where you can combine a multitude of filters to really get specific. If you want to learn more, check out the docs we have on our Routes here
Next, you will need to choose among a set of Actions. We mentioned these at the beginning of the article, but we'll repeat them here for convenience:
- Forward forwards incoming emails to another environment for storage (such as another email address or maybe an endpoint on your server).
- Store and notify stores a message temporarily (for up to 3 days) where you can retrieve it using our Messages API. It also allows you to pass an endpoint or leave it empty, in which case we provide the storage URL for you to retrieve the message later via the Messages API.
- Stop stops a message from being processed (again, this drops certain messages instead of forwarding or storing them).
And finally, the last two fields are Priority and Description. In the Priority field, you can specify a priority level to determine the sequence in which the Route gets handled. Here, the lower the number, the higher the priority. The lowest number would then be handled first; like a ranking of importance. In the Description field, you can specify a description to either name or identify the Route. For instance, "Forward from subdomain1 to Alice at Example.com." This is just for your reference, to help you quickly identify just which route you're looking for.
Sinch Mailgun has answers! If you have any concerns or questions, please send us a Support ticket using the Support page within your Mailgun Control Panel. Our Support Team will be happy to assist!