0

I created a simple PHP file to handle a form and send it from a contact page to the admin of a site. It worked great on my own test server (running Windows Server), but when I transferred it to another Windows Server based machine it stopped working. I've double checked and all resources are there (I copied EVERYTHING). Everything else on the site works fine - it even gives me the success message when I press 'Send'. Anyone know what could be going wrong? The new server is on Domain.com, could they have turned something off that disables the PHP script?

2 Answers 2

1

Check with your hosting company's support. They may not permit emailing from within your site. Depending on just how they do that your script may well think that the message was sent, even though it never leaves the system. Also check that the message hasn't been swallowed by your spam filter.

2
  • Great call on the spam filter. WOW. That was it. lol I wish I was kidding
    – Zakman411
    May 9, 2011 at 8:22
  • @Zakman411, in that case you may want to check your SPF record in DNS to ensure the web server is authorised to send mail for your domain. May 9, 2011 at 11:34
0

The mechanism used for sending mail is configured in you server's php.ini file. Check to see what mechanism the server is using, and whether that mechanism works. For example, if you're using SMTP to "localhost", make sure that you're also running a local SMTP server that allows you to relay your outbound mail.

EDIT
Find out from the hosting provider what the preferred way to send mail from PHP is. They should have instructions appropriate for their hosting environment. It may involve a call or two to ini_set.

To test, just create a simple page like this, and test to make sure you get the mail.

<?php    
   if (mail("[email protected]","Test","hello")) { 
      echo "OK";
   } else {
      echo "Fail";
   }
?>
4
  • Unfortunately I can't do much since it's a shared hosting account I'm uploading to. When I ran the code on my own dedicated server, I didn't have to specify "localhost" or anything in my PHP. It just ran. Is something wrong with the server you think?
    – Zakman411
    May 9, 2011 at 8:06
  • @Zakman411: See additional comments
    – tylerl
    May 9, 2011 at 8:13
  • Thanks for the response. I tried the test on shared hosting. Said "OK" but I never got the message :( Ughh.
    – Zakman411
    May 9, 2011 at 8:19
  • turns out it was my good ol' spam filter. But thanks for the insight man
    – Zakman411
    May 9, 2011 at 8:23

You must log in to answer this question.

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