I’m trying to set up email handling for my domain using Mailgun’s API for programmatic access, but I also need some regular email accounts that work with standard email clients like Outlook or similar programs.
Specifically, I want to create normal mailboxes for:
contact@
info@
manager@
While routing all other incoming messages through the API for automated processing.
The challenge is that I cannot redirect emails to external services like Gmail since I need to maintain the original sender address (like [email protected]) when replying to customers.
What’s the best approach to achieve this mixed setup?
I’ve been running this setup for about two years now. Here’s what works: Mailgun is basically a relay service, not a full mailbox provider, so you need a hybrid approach. I set up Mailgun routes to forward specific addresses to hosted Exchange while keeping API processing for everything else. The tricky bit is keeping SMTP authentication consistent between both systems. I use Office 365 Business Basic for regular mailboxes - gives your team the professional email experience they want. Mailgun handles all the automated stuff seamlessly. Mailgun’s routing rules are pretty flexible once you figure out the priority system. This setup’s been rock solid - handles thousands of emails monthly with zero delivery problems.
I’ve dealt with this recently - keep it simple. Set up specific Mailgun routes for your business addresses that forward to Zoho Mail or Google Workspace. These handle IMAP properly and maintain domain authentication when you reply. Use exact match conditions instead of catch-all patterns to avoid conflicts. Then create a separate lower-priority route for API processing that captures everything else. This beats juggling multiple MX records or external automation services. You get clean separation between human emails and automated ones without the complexity. I’ve found it way more reliable since there’s fewer things that can break.
I’ve done this exact setup before. Use Mailgun’s routing system with a separate IMAP provider. Point your MX records to Mailgun, then set up routes in their control panel - send contact@, info@, and manager@ to something like Fastmail or Zoho that gives you proper IMAP/SMTP. Everything else goes to your API endpoint with a catch-all route. Your team gets normal email clients for those specific addresses, but you keep automated processing for everything else. Just make sure your SMTP settings use your original domain credentials for replies - most business email providers handle this through custom domain configs.
Been dealing with this for years across multiple projects. Manual routing works but it’s a nightmare to maintain and scale.
You need proper automation that handles both regular mailbox forwarding and API routing dynamically. I solved this exact problem using Latenode - created a smart email router that sits between Mailgun and your systems.
Here’s how: Set up one Mailgun webhook that sends all emails to a Latenode scenario. The automation checks recipient addresses against your list (contact@, info@, manager@) and either forwards to your business email or processes through API endpoints.
Best part? You can change routing rules instantly without touching Mailgun configs. Need a new regular mailbox? Update the scenario. Want special handling for certain senders? Add that logic.
I set this up for our support system last year. Regular team emails go to Office 365, everything else gets processed automatically. Zero maintenance headaches since.
The automation logs everything too, so you can track delivery and catch issues before they blow up.
Set up Mailgun as your primary MX handler with a dual-forwarding strategy based on recipient patterns. Configure routes to forward standard business addresses (contact@, info@, manager@) to something reliable like ProtonMail Business or Rackspace Email - these keep proper mailbox functionality while preserving your domain for outbound replies. Route everything else directly to your API webhook endpoints. Use Mailgun’s route priority system correctly - set specific address routes at priority 1 and your catch-all API route at priority 10. This eliminates the complexity of managing multiple MX records while giving you granular control over message flow. I’ve used this setup with several clients and it handles both scenarios reliably without the maintenance headache of running your own mail server.
You’re trying to set up email handling for your domain using Mailgun’s API for programmatic access, but you also need some regular email accounts that work with standard email clients like Outlook. Specifically, you want to create normal mailboxes (contact@, info@, manager@) while routing all other incoming messages through the API for automated processing. You can’t redirect emails to external services like Gmail because you need to maintain the original sender address when replying.
TL;DR: The Quick Fix:
Use Mailgun for API-based email handling and a separate, inexpensive email hosting provider (like Namecheap or GoDaddy) for standard email accounts (contact@, info@, manager@). Configure your MX records with differing priorities to direct specific emails to the appropriate service.
Understanding the “Why” (The Root Cause):
Mailgun excels at transactional and programmatic email, but it’s not designed to be a full-fledged email provider offering standard IMAP/SMTP mailbox functionality. Trying to force it into that role leads to complex routing setups and potential maintenance headaches. A simpler approach is to leverage Mailgun’s strengths (API access and routing) while using a service explicitly built for regular email accounts.
Step-by-Step Guide:
Choose a Secondary Email Provider: Select a cost-effective email hosting provider that offers standard email accounts with IMAP/SMTP access. Namecheap and GoDaddy are good examples. Sign up for an account and create the mailboxes contact@[yourdomain.com], info@[yourdomain.com], and manager@[yourdomain.com].
Configure DNS MX Records: Access your domain’s DNS settings (through your domain registrar). You’ll need to configure your MX records. You will need at least two entries:
One for your standard mailboxes using the provider’s MX server values, usually given a high priority value (e.g., 10). This entry prioritizes messages sent to contact@, info@, and manager@ to your chosen email provider.
A second MX record pointing to your Mailgun server (Mailgun provides the necessary server details). This usually has a lower priority (e.g., 20 or higher). It will be the fallback for emails that are not directly addressed to those primary email addresses.
Mailgun Route Configuration: Set up a Mailgun route that catches all emails that do not match your specific accounts (contact@, info@, and manager@) and delivers them to your Mailgun API endpoint for processing.
Test Thoroughly: Send test emails to each of your addresses to verify that they are delivered to the correct locations.
Common Pitfalls & What to Check Next:
MX Record Priority: Double-check the priority values of your MX records. Incorrect priorities can cause emails to be routed incorrectly. The lower the priority number, the higher the priority of that mail server.
DNS Propagation: DNS changes can take some time to propagate across the internet. Be patient; it might take up to 48 hours for your changes to take full effect.
Mailgun API Key: Ensure your Mailgun API key and domain are correctly configured in your application to capture the emails meant for the API.
Email Provider Configuration: Double-check the email settings (like port, encryption, etc.) for your secondary email provider and verify that your application is correctly configured to send emails from your domain.
Still running into issues? Share your (sanitized) config files, the exact command you ran, and any other relevant details. The community is here to help!
mailgun’s API is great, but it can’t directly provide normal mailboxes. You might wanna create routes for your main email addresses, forwarding them to a service that supports IMAP/POP3. Then, the rest can be handled via the API. Setting up your own mail server is another option too!