It should be possible to use AWS ec2 nano at about $1.50 / month to provide solid email service for loads clients, and at what is it (10cents a GB?) I can offer them tons of email space, and let Mailgun and/or AWS SES do the heavy lifting of virus and spam filtering.

I am running Iredmail's configuration on a ubuntu 16.04 amazon AWS ec2 VPS instance. (Make sure to disable the antivirus and spamfilter, this makes the entire instance powered under 200megabytes of RAM, lightweight and FAST. And because mailgun is going to do our scanning for us.)

1st. I have successfully sent and received email from the AWS ec2 instance without using mail gun.

2nd. I have successfully sent to [email protected] and MAILGUN forward the email to another eg. [email protected] (so I know it works and I'm not crazy!)

NOW -- Here's where I need help:

3rd. The final step. I need to catch [email protected] with mailgun and forward them to my private mail server, where they will be sorted and placed into each user's mail boxes-- from there they can login with IMAP or webmail and read and send emails.

I tried forwarding to the server IP and to the server name e.g. mx.example.com (and created a mx.example.com MX 10 mx.example.com record) and forwarding to either address does not work! (My mail.log file does not even throw an error, it's a complete disconnect!)

What am I doing wrong?

  • 1
    You will need to show your actual configuration in order for anyone to be able to help you.
    – Jenny D
    Mar 27, 2017 at 13:39

2 Answers 2


I need to catch [email protected] with mailgun and forward them to my private mail server

That isn't how email deliver works. When someone sends an email to [email protected] the mail is delivered to the server(s) identified in the MX record(s) for domain.com. You need to make sure your TTL is appropriately set on the MX record or you may have to wait a while for the change to go into effect.

  • I am successfully using mxguarddog to forward the mail to my server, exactly as I hoped mailgun would be able to-- and this shows that I do not necessarily have things messed up on my end. I am using Route53 DNS and the settings take effect almost instantly whenever I make changes, I am just about positive DNS is not the problem. I do not know why I cannot get mailgun to talk to my server.
    – Adam
    Mar 21, 2017 at 1:13
  • If you provide the domain name we can look at more information. Mar 21, 2017 at 2:22

I have received contact from Mailgun's support team and they said the following:

James Burns (Mailgun Support) Mar 21, 10:09 PM CDT

Hello Adam,

Our forwarding system can only forward messages to an external email. For example

Incoming message >> [email protected] >> forwards >> [email protected]

You can find out about MailGun routes below


Please let us know if you have any questions.

Thanks, James@MG

So to answer my original question, Mail routed by Mailgun will only route to another email address, and not to another mail server's mail.domain.com or IP address.

Meanwhile S3 seems to largely be limited on the receiving features end by only allowing mail to be stored in S3 buckets and current solutions for using an S3 bucket as a database for an email server are not well developed at this time, perhaps lacking motivation as Amazon would rather promote its' flagship "Workmail" solution.

I did however complete my project, by using Mxguarddog to receive incoming mail for my domains and route the mail to my private webserver hosted in AWS ec2 cloud instance (free for 1 year, cost a few bucks a month afterwards.) And I am successfully sending all mail using postfix integration with Amazon SES.

I consider the project a success, but I do wish I could find a more "enterprise" grade mail routing/filtering solution for incoming mail than mxguarddog. Do make sure to only allow Port 25 smtpd with mxguarddog IP addresses.

In effect, I have a scaleable mail server where I can provide my clients email hosting with unlimited space (costing me .10 a GB) for storage space using an amazon EC2 VPS instance (couple bucks a month).

The mail server is efficient and operates on about 200MB/RAM by outsourcing virus and spam scanning to Mxguarddog (receiving) and Amazon SES (outgoing), (as well as receiving "reputation" for going through an established mail send point), and finally all is passing DKIM and SPF verification. Lastly, using letsencrypt for free ssl.

More information here about how I got everything working: http://www.iredmail.org/forum/post55270.html#p55270

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .