I am trying to make a registration form and after submitting it will send a confirmation link for verification. I am using the php mail function. It echo's that the mail has been sent but after waiting for several minutes no email has been sent. I config my localhost to localhost:8080 and been using 3307 for my database and everything's fine because it feed in my database. My problem is that no email is sent. Can you tell me what is wrong or what i need to do to make this work because im just a beginner. Thanks:)
Here is my code:
<?php
include('config.php');
// table name
$tbl_name='temp_members_db';
// Random confirmation code
$confirm_code=md5(uniqid(rand()));
// values sent from form
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$email=$_POST['email'];
$pword=$_POST['pword'];
$number=$_POST['number'];
$house=$_POST['house'];
$street=$_POST['street'];
$city=$_POST['city'];
// Insert data into database
$sql="INSERT INTO $tbl_name(confirm_code, firstname, lastname, email, password, number, house1, street1, city)VALUES('$confirm_code', '$firstname', '$lastname', '$email', '$pword', '$number', '$house', '$street', '$city')";
$result=mysql_query($sql);
// if suceesfully inserted data into database, send confirmation link to email
if($result){
// ---------------- SEND MAIL FORM ----------------
// send e-mail to ...
$to=$email;
// Your subject
$subject="Your confirmation link here";
// From
$header="from: Athan Motorcycles <nickcuenza@gmail.com>";
// Your message
$message="Your Confirmation link \r\n";
$message.="Click on this link to activate your account \r\n";
$message.="http://www.yourweb.com/confirmation.php?passkey=$confirm_code";
// send email
$sentmail = mail($to,$subject,$message,$header);
}
// if not found
else {
echo "Not found your email in our database";
}
// if your email succesfully sent
if($sentmail){
echo "Your Confirmation link Has Been Sent To Your Email Address.";
}
else {
echo "Cannot send Confirmation link to your e-mail address";
}
?>
so the messages from the POP3 said that
Connection from 127.0.0.1, Sat Dec 14 01:58:22 2013
User root, (2) 0 messages, 0 bytes
1 sec. elapsed, connection closed Sat Dec 14 01:58:23 2013
Connection from 127.0.0.1, Sat Dec 14 01:58:54 2013
Connection from 127.0.0.1, Sat Dec 14 01:59:08 2013
User root, (2) 0 messages, 0 bytes
1 sec. elapsed, connection closed Sat Dec 14 01:59:09 2013
Connection from 127.0.0.1, Sat Dec 14 01:59:40 2013
User root, (2) 0 messages, 0 bytes
1 sec. elapsed, connection closed Sat Dec 14 01:59:41 2013
Connection from 127.0.0.1, Sat Dec 14 02:00:12 2013
User root, (2) 0 messages, 0 bytes
1 sec. elapsed, connection closed Sat Dec 14 02:00:13 2013
Connection from 127.0.0.1, Sat Dec 14 02:00:44 2013
User root, (2) 0 messages, 0 bytes
1 sec. elapsed, connection closed Sat Dec 14 02:00:45 2013
Connection from 127.0.0.1, Sat Dec 14 02:01:16 2013
User root, (2) 0 messages, 0 bytes
1 sec. elapsed, connection closed Sat Dec 14 02:01:17 2013
Connection from 127.0.0.1, Sat Dec 14 02:01:48 2013
User root, (2) 0 messages, 0 bytes
1 sec. elapsed, connection closed Sat Dec 14 02:01:49 2013
Connection from 127.0.0.1, Sat Dec 14 02:02:20 2013
User root, (2) 0 messages, 0 bytes
1 sec. elapsed, connection closed Sat Dec 14 02:02:21 2013
Connection from 127.0.0.1, Sat Dec 14 02:02:52 2013
User root, (2) 0 messages, 0 bytes
1 sec. elapsed, connection closed Sat Dec 14 02:02:53 2013
Connection from 127.0.0.1, Sat Dec 14 02:03:24 2013
User root, (2) 0 messages, 0 bytes
1 sec. elapsed, connection closed Sat Dec 14 02:03:25 2013
Connection from 127.0.0.1, Sat Dec 14 02:03:56 2013
User root, (2) 0 messages, 0 bytes
1 sec. elapsed, connection closed Sat Dec 14 02:03:57 2013
Connection from 127.0.0.1, Sat Dec 14 02:04:28 2013
User root, (2) 0 messages, 0 bytes
1 sec. elapsed, connection closed Sat Dec 14 02:04:29 2013
after checking the session it said that
01:59:08.609: Connection from 127.0.0.1, Sat Dec 14 01:59:08 2013
01:59:08.609: << +OK <6495609.23560@localhost>, POP3 server ready.<cr><lf>
01:59:09.593: >> USER root<cr><lf>
01:59:09.593: << +OK root is known here.<cr><lf>
01:59:09.593: >> PASS root<cr><lf>
01:59:09.593: << +OK Welcome! 0 messages (0 bytes)<cr><lf>
01:59:09.593: >> STAT<cr><lf>
01:59:09.593: << +OK 0 0<cr><lf>
01:59:09.593: >> QUIT<cr><lf>
01:59:09.593: << +OK localhost Server closing down.<cr><lf>
01:59:09.593: --- Connection closed normally at Sat Dec 14 01:59:09 2013. ---
01:59:09.593: