Jump to content


Photo

Mail Sending Error


  • Please log in to reply
No replies to this topic

#1 alagardeGSMHP

alagardeGSMHP

    Newbie

  • New Members
  • Pip
  • 1 posts

Posted 04 March 2014 - 07:34 PM

Hey guys I've been getting this problem for a couple days now and it is highly likely this issues has been mentioned in this forum more than a few times but

 

HOW DO I GET PHP TO MAIL TO EXTERNAL ADDRESSES!

 

I'm developing a reset password function on the company website that sends to the email along with their new random generated ID (which i have yet to create.)

 

Everything is fine and dandy when i send it to local email but php generates this error:

 

Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay in C:\xampp\xampp\htdocs\passwordreset.php on line 101

 

I don't know if this is a php coding issue or a exchange issue

 

Here is a copy of my code:

 

<?php


$s=$_POST['s'];
if(isset($s)){


$username = $_POST['username'];
$email = $_POST['email'];


$query = "SELECT * FROM authuser WHERE username = '$username'";
$result = mysql_query($query);




if (!$result) {
    $message  = 'Invalid query: ' . mysql_error() . "\n";
    $message .= 'Whole query: ' . $query;
    die($message);
}


$num = mysql_numrows($result);


//$row = mysql_fetch_assoc($result);


$i = 0;
while ($i < $num){ 


$USERNAME=mysql_result($result, $i, "username");
$EMAIL=mysql_result($result, $i, "EMAIL");
     
$newpassword = substr(md5(uniqid(mt_rand(), true)), 0, $l);




$subject = "HEALTH PORTAL PASSWORD RESET";
$message = "You have requested a password reset for the health portal Password for username ".$USERNAME."has been reset You have been assigned the default password ".$newpassword." The system will prompt you to change your password


$message = wordwrap($message, 70);
$to = $EMAIL;
$from = "From:alagarde@gsmhp.com";







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

Any Ideas? I'm running Microsoft exchange server 2007 I believe

 

Thanks,

 

-Abe






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com