I want to send email by clicking on button using aframe. I did something but that does not work. Here is working flow. I have database and I am getting user email form database. Here is html:
<a-plane id="information-button" name="button-press" class="clickable" 
 position="6 -4.845 3" rotation="0 -30 0" width="3" height="1" color="#000">
      <a-text value="More Info" position="-0.946 0.077 0.349" scale="2 2 2"> 
      </a-text>
</a-plane>
Here is email.php to send the email.
<?php 
include('server.php');
session_start();
?>
<?php 
if (isset($_POST['button-press'])) {
require "PHPMailer/src/PHPMailer.php";
require "PHPMailer/src/OAuth.php";
require "PHPMailer/src/SMTP.php";
require "PHPMailer/src/POP3.php";
require "PHPMailer/src/Exception.php";
require 'PHPMailer/src/PHPMailerAutoload.php';
use PHPMailer\PHPMailer\PHPMailer; 
use PHPMailer\PHPMailer\Exception;
if (isset($_SESSION['email'])){
    $headers = "MIME-Version: 1.0" . '\r\n';
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . '\r\n'; 
    $message = '<p><strong>You are in.</strong></p>';
    $subj = 'More Information';
    $to = 'falak@oddly.co';
    $from = 'falaksabbir3@gmail.com';
define('GUSER', 'falaksabbir3@gmail.com'); // GMail username
define('GPWD', '******');
define('SMTPUSER', 'falaksabbir3@gmail.com'); // sec. smtp username
define('SMTPPWD', '******'); // sec. password
define('SMTPSERVER', 'smtp.gmail.com'); // sec. smtp server
//send mail
if ( smtpmailer($to, $from, $name, $subj, $message,$headers)){
        echo 'Message send via Gmail';
    } else {
        if (!smtpmailer($to, $from, $name, $subj, $message,$headers)){
            if (!empty($error)) echo $error;
        } else {
            echo 'Yep, the message is send (after doing some hard work)';
        }
    }
//send email function
function smtpmailer($to, $from, $from_name, $subject, $body, $is_gmail = true) { 
    global $error;
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->SMTPAuth = true; 
    if ($is_gmail) {
        $mail->SMTPSecure = 'ssl'; 
        $mail->Host = 'ssl://smtp.gmail.com';
        $mail->Port = 465;  
        $mail->Username = GUSER;  
        $mail->Password = GPWD;   
    } 
    else {
        $mail->Host = SMTPSERVER;
        $mail->Username = SMTPUSER;  
        $mail->Password = SMTPPWD;
    }        
    $mail->SetFrom($from, $from_name);
    $mail->Subject = $subject;
    $mail->Body = $body;
    $mail->IsHTML(true); 
    $mail->AddAddress($to); 
    if(!$mail->Send()) {
        $error = 'Mail error: '.$mail->ErrorInfo;
        return false;
    } else {
        $error = 'Message sent!';
        return true;
    }
}
}}
?>
So this is how I did. Can I do php with aframe? Or any guidelines with this.
 
     
    