Ich bin fast fertig für meine Projektarbeit, allerdings will ich bei der Registrierung eine E-Mail Verifikation schicken mit einem Code. Als ich es dann geschrieben habe. kam dieser Fehler. Ich bin am verzweifeln. Ich habe in XAMPP Apache, MySQL und Mercury aktiviert.
In der PHP.ini datei habe ich folgendes stehen:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
; https://php.net/sendmail-from
;sendmail_from = Admin@localhost
[edit by Mod] [ code=php ] [ /code ]-Tag eingepflegt
PHP:
if (empty($errors)){
$activation_code = md5(rand());
$sql = "INSERT INTO users (username, email, password, activation_code) VALUES (?, ?, ?, ?);";
$stmt = $db->prepare($sql);
if($stmt->execute([$username, $email, password_hash($pwd, PASSWORD_DEFAULT), $activation_code])){
//header("location: login.php");
$mail_link = "[URL]http://localhost//Webseite/email_verify.php[/URL]";
$mail_link .= '?email='.$email;
$mail_link .= '&activation_code='.$activation_code;
if(mail($email, 'Anmeldebestätigung', $mail_link, "From: Webmaster")){
echo "Anmeldung erfolgreich. Bitte bestätige deinen E-Mail Link.";
}
else{
$sql = "DELETE FROM users Where email = ?";
$stmt = $db->prepare($sql);
$stmt->execute([$email]);
array_push($errors, 'Fehler beim Senden der Bestätigungsmail. ');
}
}
else{
array_push($errors, 'Es ist ein Fehler aufgetreten.');
}
}
In der PHP.ini datei habe ich folgendes stehen:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
; https://php.net/sendmail-from
;sendmail_from = Admin@localhost
[edit by Mod] [ code=php ] [ /code ]-Tag eingepflegt
Anhänge
Zuletzt bearbeitet von einem Moderator: