ShaneW ShaneW - 1 month ago 4
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.

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


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

Answer

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.

Comments