cluce Posted May 21, 2007 Share Posted May 21, 2007 my situation: I am in an internal network that is using our company's SMTP. I am working on a forgot password page for our website. When I type in an email and submit it it verifies that the email is in the database and sends that email account the username and password. This only works with the company's email accounts such as me@company.com but when I use me@yahoo.com it does not send the username and password. I receive these errors.... Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for me@yahoo.com in C:\wamp\www\email_info.php on line 28 Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\email_info.php:28) in C:\wamp\www\email_info.php on line 30 can someone tell me what the problem may be???? Quote Link to comment Share on other sites More sharing options...
cunoodle2 Posted May 21, 2007 Share Posted May 21, 2007 Post some code so we can see what you are working with. Quote Link to comment Share on other sites More sharing options...
cluce Posted May 21, 2007 Author Share Posted May 21, 2007 ok here is the code...... <?php //initialize the session if (!isset($_SESSION)) { session_start(); } //connects to database $mysqli = mysqli_connect("localhost", "root", "", "test"); //check to see if email exists in database/table $usercheck = strip_tags(trim($_POST['email'])); $check = mysqli_query($mysqli,"SELECT email FROM auth_users WHERE email = '$usercheck' LIMIT 1"); $check2= mysqli_num_rows($check); //if the email does not exist, it gives an error if ($check2 != 0) { //create and issue the query $sql = "SELECT username, password FROM auth_users WHERE email = '".$_POST["email"]."' LIMIT 1"; $res = mysqli_query($mysqli, $sql); $bodyArr = mysqli_fetch_array($res); //send query through email $to = $_POST["email"]; $subject = "Account Information"; $body = "Username: " . $bodyArr['username'] . "\nPassword: " . $bodyArr['password']; mail ($to, $subject, $body); header("Location: http://localhost/Account_information.html"); }else{ $_SESSION['emailExists'] = "<font color='red'>The email"." ".$_POST['email']." "."does not exist in our database.<br>You may register for free by filling out the online registration form.</font>"; header ("Location: forgot_password.php"); } mysqli_close($mysqli); ?> Quote Link to comment Share on other sites More sharing options...
HoTDaWg Posted May 21, 2007 Share Posted May 21, 2007 well you are using a wamp server, so wamp is probably using a third party SMTP server. find out what the SMTP server is, visit their site, and ask on their forums. the code looks fine to me, or i could be wrong lol. i wish i could be more help, HoTDaWg Quote Link to comment Share on other sites More sharing options...
cluce Posted May 21, 2007 Author Share Posted May 21, 2007 thanks for the reply. I think my code is right too. For some reason the mail server doesn't wont to relay the message externally. It does send email just not to my external accounts(ex. gmail, yahoo,etc.). It only sends the messges to my company email accounts. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.