This code for sending account verification mail stopped working. It is not throwing any error but also not sending the email. Pl | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

This code for sending account verification mail stopped working. It is not throwing any error but also not sending the email. Pl

<?php require "phpMailer/PHPMailer/PHPMailerAutoload.php"; $mail = new PHPMailer(); // initializing variables $errors = array(); // connect to the database $db = mysqli_connect('localhost', 'servername', 'password', 'gac'); // REGISTER USER if (isset($_POST['reg_user'])) { // receive all input values from the form $username = mysqli_real_escape_string($db, $_POST['username']); $email = mysqli_real_escape_string($db, $_POST['email']); $password_1 = mysqli_real_escape_string($db, $_POST['password_1']); $password_2 = mysqli_real_escape_string($db, $_POST['password_2']); $_SESSION['username'] = $username; $_SESSION['success'] = "You are now successfully registered"; // form validation: ensure that the form is correctly filled ... // by adding (array_push()) corresponding error unto $errors array if (empty($username)) { array_push($errors, "Username is required"); } if (empty($email)) { array_push($errors, "Email is required"); } if (empty($password_1) || strlen($password_1)<8) { array_push($errors, "Password is required and must be 8 length in characters"); } if ($password_1 !== $password_2) { array_push($errors, "The two passwords do not match"); } // first check the database to make sure // a user does not already exist with the same username email $user_check_query = "SELECT * FROM registered_users WHERE email='$email' LIMIT 1"; $result = mysqli_query($db, $user_check_query); $user = mysqli_fetch_assoc($result); if ($user) { // if user exists /* if ($user['username'] === $username) { array_push($errors, "Username already exists"); }*/ if ($user['email'] === $email) { array_push($errors, "email already exists"); } } // Finally, register user if there are no errors in the form if (count($error

15th Apr 2020, 7:07 PM
Learner
3 Answers
+ 2
Your code got cut off. Paste it on pastebin or other paste service (gist, hastebin etc.) and send the link here. It'll make it easier for us to debug and inspect the code.
15th Apr 2020, 9:32 PM
inxanedev!
inxanedev! - avatar
+ 1
https://pastebin.com/2Z23yuKK Please check and help me in debugging
16th Apr 2020, 5:34 AM
Learner
+ 1
InxaneNinja please help me in debugging this
16th Apr 2020, 8:37 PM
Learner