Conan Posted March 28, 2013 Share Posted March 28, 2013 (edited) Hello everyone, I'm new here, and I don't know where am I suppose to post this, but I think it's here .So, as the title says, my problem is that I've made everything correct, but the mail doesn't send to my email, or to the email I want, but it passes the code (I mean it gives me that "successfuly sent"), but when I check my email, there is nothing . here is the code, please id there is anything wrong tell me <?PHPfunction checkrow11($query1) { $query = mssql_query($query1); if(mssql_num_rows($query) > 0) { return true; } else { return false; } }/////////////////////////////// Coded By Conan ///////////////////////////////////if(isset($_POST['recover'])){ $email = $_POST['emadd']; if($email == '') { $err = "Fill in all the empty fields please."; } else { if(checkrow11("SELECT * FROM Account WHERE Email = '".$email."'") == true) { $query111 = odbc_exec($connect, "SELECT UserID FROM Account WHERE Email = '".$email."'"); odbc_fetch_row($query111); $userid = odbc_result($query111, 1); $query112 = odbc_exec($connect, "SELECT Password FROM Login WHERE UserID = '".$userid."'"); odbc_fetch_row($query112); $pswd = odbc_result($query112, 1); $to = $email;$subject = "ID/Password Recover";$message = "Your UserID: ".$userid."<br>Your Password: ".$pswd;$headers = "From: Staff Team";$sent = mail($to, $subject, $message, $headers); if($sent){ $err="<font color='lightgreen'>Sent Successfuly.</font>";}else{ $err="Something went wrong, please try again later.";} } else { $err = "The E-mail you have entered is incorrect, or it's NOT found."; } }}?><div id="simplepage"><div id="simpletitle"><span style="margin-left:6px;">ID/Password Recovery</span></div><center><font size="2"><br><br>To recover your ID & Password, please enter your e-mail address in the field below.<br>The e-mail must be the ID's e-mail, you have used when you created the account.<br><br></font></center><form method="post" action=""><table id="registertable"><tr><td>Your E-Mail Address:</td><td><input type="text" maxlength="30" class="simpleinput" id="emadd" autocomplete="on" name="emadd"/></td></tr><tr><td><input type="Submit" name="recover" value="Recover !"></td><td></td></tr></table></form><br><br><center><font color="lightblue" size="2">A massage wil be sent to your e-mail, includes your ID/Password.</font></center><br><br><center><font color="pink" size="2"><?=$err;?></font></center></div> Edited March 28, 2013 by Conan Link to comment Share on other sites More sharing options...
justsomeguy Posted March 28, 2013 Share Posted March 28, 2013 The mail function will return true if the mail was successfully sent to the mail transfer agent (such as sendmail), although having it return true doesn't even necessarily guarantee that the MTA was able to send it from your server. But, it's common to assume that it was actually sent from your server and the problem is on the receiving end. Based on the mail server you're sending it to, your mail might be getting blocked for a variety of reasons. Yahoo, for example, has a list of guidelines they want mail servers to follow for their mail to be accepted. Your mail is probably ending up in a spam or junk folder. There should be plenty of discussion online for how to use the mail function to help with that. You may find it easier to use the Pear Mail package rather than the plain mail function. http://www.google.com/search?client=opera&q=php+best+practices+for+sending+email&sourceid=opera&ie=utf-8&oe=utf-8&channel=suggest Link to comment Share on other sites More sharing options...
Ingolme Posted March 28, 2013 Share Posted March 28, 2013 Are you running this on a local server or on the internet? If it's on a local server, perhaps you haven't configured PHP to work with an SMTP server. Unix systems have sendmail but Windows doesn't so you need to have special configuration for mail() to work. Link to comment Share on other sites More sharing options...
Conan Posted March 28, 2013 Author Share Posted March 28, 2013 The mail function will return true if the mail was successfully sent to the mail transfer agent (such as sendmail), although having it return true doesn't even necessarily guarantee that the MTA was able to send it from your server. But, it's common to assume that it was actually sent from your server and the problem is on the receiving end. Based on the mail server you're sending it to, your mail might be getting blocked for a variety of reasons. Yahoo, for example, has a list of guidelines they want mail servers to follow for their mail to be accepted. Your mail is probably ending up in a spam or junk folder. There should be plenty of discussion online for how to use the mail function to help with that. You may find it easier to use the Pear Mail package rather than the plain mail function. http://www.google.co...channel=suggest Oh thank you, I'll try this Link to comment Share on other sites More sharing options...
Conan Posted March 28, 2013 Author Share Posted March 28, 2013 Are you running this on a local server or on the internet? If it's on a local server, perhaps you haven't configured PHP to work with an SMTP server. Unix systems have sendmail but Windows doesn't so you need to have special configuration for mail() to work.how can I do this o.o ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now