ShaneW ShaneW - 1 year ago 72
PHP Question

PHP mail() fails to send email, no page errors. SMTP

Below is a basic block of code that should send an email upon someone landing on the page. When I visit the page, I get zero errors, however the email never arrives in my inbox. Any help would be appreciated, as I feel it has something to do with my SMTP server being remote.

If (isset($_GET["email"])) {
$email = $_GET['email'];
$to = '';
$subject='Internal Password scam';
$message = "$email clicked on the link and landed on the page.";
$headers = 'From:' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);

Some other information-
server: win64 2008 R2 Ent (Sp1)

Answer Source

For my particular problem it had nothing to do with the code. The issue had to deal with permissions set on the account that the emails were being sent to. My personal email wasn't allow to receive this type of email, the netadmin's email account used as $to and the emails went through just fine.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download