-1

I have this PHP Mail code:

<?php
$to      = '[email protected]';
$subject = 'Application for IGN '.$_POST["IGN"];
$message = 'Skype account: '.$_POST["skype"].'. IGN: '.$_POST["IGN"].'. Timezone: '.$_POST["Timezone"].'. Gender: '.$_POST["Gender"].' Livestreaming/Youtubing: '.$_POST["yt"].'. Accepts rules: '.$_POST["rules"];
$headers = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

The webpage loads fine, however I don't get the email.

I checked all the $_POST variables and they're all fine.

Jon
  • 2,566
  • 6
  • 32
  • 52

1 Answers1

1

The problem does not seem to come from the way you're using the mail function.

It does not seem to come from SMTP server availability either, or else you would have gotten a message similar to this:

Warning: mail() [function.mail]: Failed to connect to mailserver at "xxxx"
port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()
in C:\whatever\my_send_mail.php on line 293

It could, however, come from an authentication problem.

You might want to use dummy SMTP servers like PaperCut to test mailing functions locally before going live on your server.
(that is how I checked your code, by the way)

Of course I could not check the validity of your $_POST values, but I would be surprised if they turned out to be the culprit.
Since you use them only in subject and body, unless they contain really weird things like a bit of SMTP protocol that would confuse the server, they should not be a problem.

If a local send works, the next step will be to check the PHP mailer configuration on your server.

kuroi neko
  • 8,479
  • 1
  • 19
  • 43