hi everybody

this project my graduate project pls help me .. i dont understand where is error and how to sending mail ?


<table width="380" border="0" cellpadding="3" cellspacing="1" >
<td width="33%"><strong>Enter your email : </strong></td>
<td width="67%"><form name="form1" method="post" action="mm.php">
<input name="email_to" type="text" id="mail_to" size="25">
<input type="submit" name="Submit" value="Submit">





$email = $_POST['email'];
        echo "enter your mail ";
        include ("mr.php");
    $email_kntrl = mysql_query("SELECT * FROM users where email in('".$email."')");
    $email_kntrl2 = mysql_num_rows($email_kntrl);
if($email_kntrl2 == 0)
    echo '<font color="red">havent this mail </font>';
   include ("mm.php");

$new_password = sha1($random_pass);

$sql = mysql_query("update users set sifre='$new_password' where mail='$email'");
$konu = "Yeni Şifreniz:";
$mesaj = "your new password  $random_pass;

echo 'we sending ';



$host = "localhost";
$username = "root";
$password= "";

// Databasemize baglaniyoruz
@mysql_connect("$host", "$username", "$password");
@mysql_select_db("$db_name")or die("");
    echo 'Veritabanina baglanilamiyor ...';



<?php $salt = "abchefghjkmnpqrstuvwxyz0123456789";
      $i = 0;
      while ($i <= 7) {
            $num = rand() % 33;
            $tmp = substr($salt, $num, 1);
            $random_pass = $random_pass . $tmp;

Recommended Answers

All 8 Replies

Member Avatar

1. You may consider using the form heading as a <label>, placed before the input field.
2. What's the error, where is it going wrong (line number ??).

If you're on local server, you need to have a smtp or other email server running. This is something you need to set up yourself and is usually a bit of a pain.

not find to mail adress ..
i try to write mail adress... and error :

enter your mail adress (mm.php line 29)

i use to smtp mail server ( xampp mercury ) but i cant send

Member Avatar

Try changing

<input name="email_to" type="text" id="mail_to" size="25">


<input name="email" type="text" id="email" size="25" />

Because you're using

$email = $_POST['email'];

BTW: you're not validating or cleaning form input - this is VERY dangerous. Use a validation pattern - google code used to have a good one. Clean with mysql_real_escape_string().

thank you now working change password ...


now give to this error :

Warning: mail() [function.mail]: Failed to connect to mailserver at "smtp.wlink.com.np" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\project\login\mail\mm.php on line 39

Member Avatar

Yep, that's your local mailserver. Pain ain't it?

What's the code in your mm.php file - it's not too obvious from the original code as you have include(mm.php) in the middle of what I thought was the mm.php file.

Perhaps you've seen this page?


i use this xampp mercury for mail server
i working to localhost .. i dont know what am i write to line 57 ?

Member Avatar

Line 57?? I thought you said the error was coming from line 39.

my english is problem

i want to said i m didn't send to mail baceuse i dont know how to use mail function

because i write to line 57... mail(...)

yes i write to line 39 that is ok working know ... but now i dont know how to use mail fuction now this problem

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.