De php mail() functie werkt wel, omdat hij true als waarde terug geeft. Maar ik ontvang geen email als ik een account registreer. Dit had ik dus getest met de volgende stukje code:
if(mail($to, $subject, $message, $headers)){
echo "Email has been sent to<b> ".$to."</b>";
}
else{
echo "Failed sending message to <b> ".$to."</b>.";
}Maar ik weet nog steeds niet hoe ik dit probleem kan fixen. Kan iemand me misschien helpen?
Hier is de rest van mijn code die ik gebruik:
// END FORM DATA ERROR HANDLING
// Begin Insertion of data into the database
// Hash the password and apply your own mysterious unique salt
$cryptpass = crypt($p); //<-- dit wordt een 30 bit/characters cryptic hash
include_once ("php_includes/randStrGen.php");
$p_hash = randStrGen(20)."$cryptpass".randStrGen(20);
// Add user info into the database table for the main site table
$sql = "INSERT INTO users (username, email, password, gender, country, ip, signup, lastlogin, notescheck)
VALUES('$u','$e','$p_hash','$g','$c','$ip',now(),now(),now())";
$query = mysqli_query($db_conx, $sql); //<-- Dit runt de query
$uid = mysqli_insert_id($db_conx);
// Establish their row in the useroptions table
$sql = "INSERT INTO useroptions (id, username, background) VALUES ('$uid','$u','original')";
$query = mysqli_query($db_conx, $sql);
// Create directory(folder) to hold each user's files(pics, MP3s, etc.)
if (!file_exists("user/$u")) { //Als de folder met de naam van de user niet bestaat, dan maken we die folder aan.
mkdir("user/$u", 0755); //0755 zijn de folder permissies oftewel chmod
}
// Email the user their activation link
$to = "$e";
$from = "[email protected]";
/*als je een email gebruikt die ook op de server(van je host (=yomacho.host56.com)) draait
*en waar je website ook draait. Dan ontvangt de user een email in zijn inbox en niet in zijn junkbox. */
$subject = 'Facebook Clone Account Activation';
$message = '<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Facebook Clone Message</title></head><body style="margin:0px;
font-family:Tahoma, Geneva, sans-serif;"><div style="padding:10px; background:#333; font-size:24px; color:#CCC;">
<a href="http://www.yoursitename.com"><img src="http://www.yoursitename.com/images/logo.png" width="36" height="30" alt="Facebook Clone"
style="border:none; float:left;"></a>yoursitename Account Activation</div><div style="padding:24px; font-size:17px;">Hello '.$u.',<br /><br />
Click the link below to activate your account when ready:<br /><br /><a href="http://http://yomacho.host56.com/activation.php?id='.$uid.'&u='.$u.'&e='.
$e.'&p='.$p_hash.'">Click here to activate your account now</a><br /><br />Login after successful activation using your:<br />* E-mail Address:
<b>'.$e.'</b></div></body></html>';
$headers = "From: $fromn";
$headers .= "MIME-Version: 1.0n";
$headers .= "Content-type: text/html; charset=iso-8859-1n";
//mail($to, $subject, $message, $headers);
if(mail($to, $subject, $message, $headers)){
echo "Email has been sent to<b> ".$to."</b>";
}
else{
echo "Failed sending message to <b> ".$to."</b>.";
}
echo "signup_success";
exit();Ook vind ik het geen probleem als iemand me wilt helpen via Skype. Omdat ik dat ook waardeer :).
Mvg,
superky
