-1

So I have a shared hosting account that uses DirectAdmin. I have a domain that I own that is my live site. I wanted a testing environment too, but since DirectAdmin costs money, instead of setting up a local dev server, I set up a new domain (devsite.org) on my shared host. Since I didn't want to buy another domain name for testing, I just edited the hosts file (C:\Windows\System32\drivers\etc\hosts) pointing devsite.org to my shared IP address.

This works great, until I try to do any kind of work with email on my dev site. What I need to accomplish (and mimic from my live site) is to send an email to announce@devsite.org that is piped to a cgi script (handled through email forwarding in DirectAdmin). However, when I send an email from my gmail, it is undelivered because gmail doesn't know about this made up domain address.

I talked with my hosting company and they said I could set up a local mail server to work around this, but I'm fairly lost in what that means. Does anyone have any input or thoughts or even search terms to google? Is it as simple as editing some hosts file, but for emails?

Any help is appreciated! Thanks.

danbrellis
  • 370
  • 3
  • 13
  • This is a good question, but not a programming question at all. I would urge you to seek migration to https://serverfault.com/ but maybe search there for similar questions before reposting. To my understanding, you will basically require a split-horizon DNS setup so that MX results for your internal dev network point to your local mail server; then you'll need to configure it to accept this mail (indicating your MTA and/or preferred platform will help yield better answers). – tripleee Nov 20 '15 at 04:56
  • Ah- yes, of course. I don't even think about that. Sorry. – danbrellis Nov 20 '15 at 12:37

1 Answers1

0

Gmail won't deliver to your host because it doesn't know what IP address maps to "devsite.org" because you didn't buy "devsite.org" on the public internet. Your host knows which IP address maps to that because you edited the hosts file.

The alternative being suggested is that the mail be sent from your machine, which has the mapping between devsite.org and the IP address you want to associate with that (for private testing). Setting up a mail server so you can send mail from that machine with the altered hosts file is relatively common compared to other server setup tasks, and you can likely find some tutorials online. Did your hosting company mention any specific mail server they suggest setting up?

As another possible alternative, have you tried emailing that address but replacing "devsite.org" with the public IP address of the server, in the e-mail address?

WBT
  • 2,249
  • 3
  • 28
  • 40