Is it possible to send a mail from the code?
I want to make a registration and the credentials should be sent to the user again.
but simply no email arrives
what am I doing wrong
Here is the whole code
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'C:/xampp/htdocs/Kulinarik/PHPMailer-master/src/Exception.php';
require 'C:/xampp/htdocs/Kulinarik/PHPMailer-master/src/PHPMailer.php';
require 'C:/xampp/htdocs/Kulinarik/PHPMailer-master/src/SMTP.php';
$con= mysqli_connect('localhost','root','123456', 'userdata',);
$email = $_POST['email'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$password = rand(0, 999999);
$result = $con->query("SELECT email FROM signup WHERE email = '$email'");
if($result->num_rows == 0) {
$sql = "INSERT INTO signup (firstname, lastname, email, password) VALUES ('$firstname', '$lastname', '$email', '$password')";
$mail = new PHPMailer();
|
|
|
|
|
|
if ($con->query($sql) === TRUE) {
header("Location: Login.html");
} else {
echo "Error: " . $sql . "<br>" . $con->error;
}
}
else {
echo "User ist bereits registriert";
}
?>
I would really appreciate your help
EDIT 1 i added the phpmailer to my file and loaded it into the code but how am i going to send an email with it ?