1

I've moved my website from this address to this address

Both are hosted by OVH.com

The issue is that now my forms are not getting sent anymore, you can try by inputting something in the contact form at the bottom of the screen and click send (you'll get the green OK message but the message won't go through).

I thought this could be linked to the .htaccess but they are both set the same way:

SetEnv PHP_VER 5_3

SetEnv REGISTER_GLOBALS 0

Any idea what the issue is? I suspect that might be an issue with the htaccess. Does anybody know how to check the php version? EDIT: PHP seems fine, 5.3 is running, as expect

PHP

<?php
// Email Submit
// Note: filter_var() requires PHP >= 5.2.0
if ( isset($_POST['email']) && isset($_POST['name']) && isset($_POST['message']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ) {

  // detect & prevent header injections
  $test = "/(content-type|bcc:|cc:|to:)/i";
  foreach ( $_POST as $key => $val ) {
    if ( preg_match( $test, $val ) ) {
      exit;
    }
  }

  //send email
 mail( "dfds@fds.com", "Nouveau message de: ".$_POST['name'], $_POST['message']."\nDepuis la page: ". str_replace("http://", "", $_SERVER['HTTP_REFERER']), "From:" . $_POST['email'] . "\r\n" . "BCC: gdsfdsri@gmail.com" );

}
?>
Greg
  • 3,025
  • 13
  • 58
  • 106
  • 2
    Nope. And since you haven't provided any code here, or any useful details at all, we can't really help you. – Marc B Jul 07 '14 at 19:13
  • 1
    I just tried the form, and it seems to post jsut fine. Got the green bar, got the AJAX send request to sendmessage.php with POST `fields: email asdf@asd.com message asdf name asdf` – RedactedProfile Jul 07 '14 at 19:13
  • Thanks DJDarkViber. Yes not sure what it's green but it doesn't work. When I send a message from the old domain I receive it instantly, here not at all. Also, if you try the newsletter on this page http://goo.gl/cZgzqq it gives you a message that the email is not valid which is not true (this message also happens when the newsletter script doesn't work) – Greg Jul 07 '14 at 19:19
  • what about the SMTP configs on new domain? you need to edit your question cause the issue is not mentioned there, not clear if the forms aren't sent or just the emails aren't sent – G.Mendes Jul 07 '14 at 19:24
  • Not sure... Is there a way to compare the setup of both? (i.e. via an online tool)? – Greg Jul 07 '14 at 19:35
  • @Greg Do you have command-line access on your server? If so, run 'echo "This is a test." | mail -s Testing youraddress@somewhere.com' If you don't have command line access, you'll probably need to file a support ticket with OVH.com. – Anthony Jul 07 '14 at 21:00

1 Answers1

1

I'd first check whether your mail() command works at all. I'm going to wager it doesn't. If it doesn't, the form itself is not a factor - you'll need to see whether postfix/something else is installed on your new server.

Anthony
  • 5,275
  • 11
  • 50
  • 86
  • I've just tried this, I get a success message but nothing in my inbox... (of course I've replaced email@example by my email address) Message successfully sent!"); } else { echo("

    Message delivery failed...

    "); } ?>
    – Greg Jul 07 '14 at 19:56
  • I believe success may mean that it was handed to postfix, but it doesn't mean postfix is actively processing jobs. I vaguely remember getting success messages when there was no mail daemon installed many moons ago. I'd search different SO threads on how to verify whether a mail server is set up. When you moved servers, do you remember configuring it? You may want to look at http://stackoverflow.com/questions/8803994/php-mail-not-working-for-some-reason – Anthony Jul 07 '14 at 20:00
  • Thanks. I didn't configure it, this is a basic hosting bought on OVH.com. Is there a way for me to compare both setups (the one that works and the one that doesn't work) myself? Thanks – Greg Jul 07 '14 at 20:14
  • As recommended in http://wycks.wordpress.com/2013/10/09/when-phps-mail-function-doesnt-work/, I'd run "echo "This is a test." | mail -s Testing someone@example.com" from your old server and your new server and compare the results. The linked article also has suggestions on resolution. Do you have sudo access on your hosting provider? – Anthony Jul 07 '14 at 20:34
  • Thanks. I'm not sure to understand the instructions in your article.. I just need to put the echo line btw my body tags like this? No php tags? echo "This is a test." | mail -s Testing someone@example.com – Greg Jul 07 '14 at 20:39
  • I've found the issue, I had to activate something in my admin panel of my host! All set! – Greg Jul 07 '14 at 21:17