Blog

How to integrate email replies into a web application

Amy Elliott Amy Elliott
· 8 min read · Tips and resources · May 28th, 2025
Inbound routing is super effective at organizing and improving communication workflows. But another awesome way to use it is to make your web app interact with email using email parsing and webhooks.

Think of reservation apps like Airbnb that let you reply to messages from your inbox, CSMs like HelpScout where you can reply to support tickets, or collaboration tools like Google Docs that let you respond to comments. 

It improves the user experience of your app, allowing people to quickly respond directly from the email.  And as a result, removing the need to navigate to your app to reply to a message or post a comment will ensure higher engagement and swifter communication.

Sounds awesome! But for custom apps, creating this level of integration is a lot of work, which is one of the reasons it’s mostly adopted by large organizations. With MailerSend, the hard work is taken care of, so you can enjoy the same advanced functionality as Airbnb or Google Docs!

You can configure your application to receive emails from MailerSend's API with inbound email routing. This means you can manage two-way conversations with your users via a commenting system. You can even parse attachments and forward them to your app via webhooks.

Why use inbound email routing for comments?

Using inbound routing from an email service provider (ESP) is a dev-friendly and scalable way to implement email replies for comments and messages. It saves massive amounts of time and avoids the hassle of building a solution from scratch while being reliable out of the box.

Challenges of custom email integration

Integrating email into your app with a custom solution is tricky. For starters, the internet and email run on completely different protocols. You'd need to develop a mechanism and a mail daemon to poll the inbox of every relevant account. You'd also need fuzzy logic to scan the contents and attachments of each message and deliver it to the appropriate comment.

You’ll need to deal with:

  • Parsing raw MIME email content

  • Ensuring your system is secure and protected from malicious emails, spam, and unsafe attachments

  • Managing an inbound mail server and keeping software updated

  • Monitoring for abuse

  • Managing sender reputation and making sure you don’t get blocklisted

And that's not including email storage and logging requirements. It's a lot of work, to be sure. You can make your life much simpler by using MailerSend's inbound routing feature.

The benefits of using MailerSend for inbound email processing

As a developer, managing email can honestly be a bit of a hassle. There are a lot of variables when it comes to managing mail servers, monitoring deliverability, and ensuring your system is secure. ESPs take care of all of that for you, and as an added bonus, they come with some pretty nice features out of the box and ready to use, including inbound routing. Here’s how MailerSend helps:

  • It handles raw email for you, parsing out unnecessary data, processing it and forwarding it to an endpoint to be seamlessly integrated into your app

  • The right security measures are built-in and up to date, meaning you needn’t worry about email authentication, encryption and secure webhooks

  • An expert deliverability team monitors for suspicious activity, blocklisting, and high bounce rates while constantly optimizing for maximum delivery rates and reliability

  • With SDKs in multiple languages, it’s much faster to integrate into your existing stack

Use case example: Hiring platform

Consider a hiring platform or SaaS product that enables users to create job listings, collaborate with team members, and communicate with potential candidates. As a product focused on the human experience—and not just numbers—efficient and productive communication is a top priority.

So, how could you enable users to send and receive email messages directly from the app’s dashboard, without the need to head to their inboxes to get replies? Setting a forwarding rule from the email client to the app might work. But it would involve using raw email parsing logic and storing email logs— not a convenient solution! 

By implementing inbound routing, the email could instead be forwarded to MailerSend, where it would be parsed and details would be logged, and then it would finally be forwarded on to the hiring app. 

Users would then be able to view and manage entire email threads from the app interface, without having to go to their email inbox. 

Pretty cool, right? Now we’ll share how you can set this up yourself.

How to enable the posting of comments/messages via email replies

With MailerSend, posting comments with email replies is as easy as creating an API token, configuring an inbound route, and linking it via a webhook. Inbound routing receives emails based on the filters you choose, parses the mails into JSON, and POSTs them to your application's endpoint URL.

If you haven't done so already, you'll need to create an API token under the Domains page and give it the appropriate permissions. If you opt to give your API token custom permissions, you'll need to provide full access to Email and Webhooks.

Setting up a webhook

Set up a webhook URL in your app, it should be able to receive JSON payloads and answer back with a 500 error or a 200 OK status. Note that the inbound webhook has a retry mechanism.

Setting up an inbound route

To set up an inbound route, you'll need to head to the Domains page of your MailerSend account. If you haven't already done so, you'll need to verify your domain and configure it with MailerSend's DNS settings.

With your domain verified, follow these steps:

  1. From the Domain page, scroll down to the Inbound route section and click Create an inbound route.

  2. Add a name for your inbound route. This is just so you can identify it.

  3. In the Inbound address field, you'll see an automatically generated address. Use this or enter your own custom address. If using a custom address, you'll need to add a custom MX record to your DNS management platform.

  4. Check the box to enable Inbound domain forwarding.

  5. Configure the Catch filters to select which inbound emails are accepted based on the address recipients are sending to.

  6. You can also configure the Filter emails section to specify which emails are accepted based on the address recipients are sending from.

  7. Finally, add the endpoint URL or email address you want email content to be routed to.

  8. Click ‘Save route” and you’re done!

Page for creating an inbound route in MailerSend.

Your internal route is now configured and ready to use. If you have any issues, take a look at the full documentation for internal routes. Otherwise, let's set up a webhook so you can communicate with the MailerSend API.

You can check inbound activity by going to the domains page for your domain, scrolling to the Inbound routing section and clicking your inbound route. Then, scroll down to the Inbound activity log.

How to create an inbound route via API:

To create a new inbound route to route incoming emails to your endpoint URL, use the following POST request:

POST https://api.mailersend.com/v1/inbound

The request body will look something like this, where under the forwards parameter, type will equal ‘webhook’ and value will equal your webhook URL. 

{
   "domain_id":"7nxe3yjmeq28vp0k",
   "name":"Test name",
   "domain_enabled":true,
   "inbound_domain":"test.remotecompany.com",
   "inbound_address":"test@inbound.mailersend.net",
   "inbound_subdomain":"inbound",
   "match_filter":{
      "type":"match_all"
   },
   "catch_filter":{
      "type":"catch_recipient",
      "filters":[
         {
            "comparer":"equal",
            "value":"test"
         }
      ]
   },
   "forwards":[
      {
         "type":"webhook",
         "value":"https://www.mailersend.com/hook"
      }
   ]
}

And that's all there is to it. You now have real-time polling of inbound email threads based on the filters you set in your route. You can use the webhook's API key to access messages in your app and build a commenting system that enables you to respond via email.

Check out our SDKs for code samples you can use to create inbound routes:

What else can inbound routing do?

With MailerSend's inbound routing feature, there are tons of possibilities. Using webhooks and your imagination, the sky's the limit. 

If your app relies on email for communication, there's no need to have your users go to their inbox to follow the thread—simply integrate the whole experience within your app. But there are also other ways you can use inbound routing, including for email-based functionality beyond messaging.

  • You can: Manage support emails from your application

  • Build a forum using email threads

  • Create a commenting plugin for websites

  • Enable anonymized in-app chat

  • Process content from emails and attachments to integrate data, for example, to upload a blog post, add flight details, or create a to-do list

Check out our article on inbound routing to learn more.

Integrating email replies is easier with inbound routing

Now you know how to set up transactional email to have replies parsed directly from email to your app, making communication for users and customers more efficient. 

If you're looking for the simplest way to manage your app's email communication, MailerSend's email API is an excellent solution for handling both transactional emails and inbound routing. Save development time by using inbound routing to power your app's email messaging.

Ready to build an amazing feature in your app using MailerSend's inbound routing feature? Check out the API documentation to learn more. Let us know in the comments how you'll be using inbound routing.

Make your transactional messaging interactive

Sign up to MailerSend for free and get 3,000 emails to start out with. Want to try out inbound routing for yourself? Upgrade to a Starter plan at any time.

Amy Elliott
I’m Amy, Content Writer at MailerSend. As a child, I dreamt about writing a book and practiced by tearing pages from an A4 notepad and binding them with sugar paper. The book is pending but in the meantime, I love taking a deep dive into technical topics and sharing insights on email metrics and deliverability.