<?php
session_start();

require("../includes/app_credentials.php");
require("includes/email-credentials.php");

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';

require("../includes/db_connect.php");

	$mail = new PHPMailer(true);
	
	$email = "brainygatesprojects@gmail.com";
	$name = "Brainy";
	
	$smtp_host = "premium241.web-hosting.com";
	$smtp_username = "noreply@rocketta.io";
	$smtp_password = "6iZUh,~0B*zu";
	$smtp_encryption = "tls";
	$smtp_port = "587";

	try {

		//Server settings                          
		$mail->isSMTP();
		$mail->Host = $smtp_host;
		$mail->SMTPAuth = true;
		$mail->Username = $smtp_username;
		$mail->Password = $smtp_password;
		$mail->SMTPSecure = $smtp_encryption;
		$mail->Port = $smtp_port;

		//Recipients
		$mail->setFrom($smtp_email, $web_app_name);
		$mail->addAddress($email, $name);

		//Content
		$mail->isHTML(true);
		$mail->Subject = $name . ", please activate your account";

		$mail->Body = "Hi there";

		$mail->send();
		
		die("success");
	} catch (Exception $e) {
		die("Unable to send verification mail: " . $mail->ErrorInfo);
	}
