Posted by:
Jpergega
(---.13-3.cable.virginm.net)
Hi
I have followed this video [
www.youtube.com] to setup the send email and I have double checked few times but I am getting the error message cannot send email please can you help me to see where went wrong.
and here is my code:
$username = $_POST['username'];
$password = $_POST['password'];
$email= $_POST['email'];
$permission = $_POST['permission'];
$firstname = $_POST['firstname'];
$surname = $_POST['surname'];
$activation = md5(uniqid(rand()));
$sql2 = "INSERT INTO useraccount (username, email, password, permission, activation, firstname, surname) VALUES ('$username', '$email', '$password', '$permission', '$activation', '$firstname', '$surname')";
$result2 = mysqli_query($con,$sql2) or die(mysqli_error());
if($result2)
{
$to = $email;
$subject = "Your comfirmation email";
$header = "from: your name <your email>";
$message = "Thank you for registering with us. You can now login to your account";
$sendmail= mail($to, $message, $subject, $header);
if($sendmail)
{
echo 'Your Confirmation Email Has Been Sent To Your Email Address.<a href="login.php">Click here to Login</a>';
}
else
{
echo 'Cannot send Confirmation link to your e-mail address.<a href="login.php">Click here to Register</a>';
}
}
}
}