isSMTP(); $mail->Host = "smtp.gmail.com"; $mail->SMTPAuth = true; $mail->Username = "teamgesse2020@gmail.com"; //Enter your password and replace you gmail above with mine $mail->Password = "teamgeese1234"; $mail->Port = 465; $mail->SMTPSecure = "ssl"; //To make it more fancy //the contents below will implement the following: $email_from = "TEAM GEESE"; $email_headers = "From: ".$email_from."\r\nReply-To: ".$email_from."\r\n"; $email_headers .= "MIME-Version: 1.0\r\n"; $email_headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; // load the email to and subject from the $swap_var $email_to = $swap_var['{TO_EMAIL}']; $email_subject = $swap_var['{EMAIL_TITLE}']; $verifyCode = $swap_var['{VERIFY_CODE}']; // load in the template file for processing (after we make sure it exists) // if (file_exists($templateFile)) // $email_message = file_get_contents($templateFile); // else // die ("Unable to locate your template file"); // foreach (array_keys($swap_var) as $key){ // if (strlen($key) > 2 && trim($swap_var[$key]) != '') // $email_message = str_replace($key, $swap_var[$key], $email_message); // } //The fancy html content ends here //Email Settings $mail->isHTML(true); $mail->setFrom($email_from,"(no-reply) Team GEESE"); $mail->addAddress($email); $mail->Subject = ("$email('Verify Geese Account')"); $mail->Body = $email_message; if($mail->send()){ $status = "Success"; $response = "Email is Sent"; exit(json_encode(array("status" => $status, "response" => $response))); }else{ $status = "Failed!"; $response = "Email couldn't be sent: " . $mail->ErrorInfo; exit(json_encode(array("status" => $status, "response" => $response))); } }