<?php

require 'admin-login.php';

$user_email = $_GET['email'];
$u_id = $_GET['id'];

$to = $user_email;

$subject = $_POST['subject'];
$text_message = $_POST['message'];

$message = " <meta name='viewport' content='width=device-width, initial-scale=1.0'>
         <div style='background-color: #4c516d; padding: 20px'>
         <img src='https://bitclubtradingnet.com/logo.png' alt='...' style='display: block; margin-left: auto; margin-right: auto; width: 50%'>
         </br>
         </div>
         <p>$text_message</p></br></div>
         
         
         Thank you for choosing Bitclub TradingNet.
         
         
         ";

require '../PHPMailer/PHPMailerAutoload.php';

         $mail = new PHPMailer;
         
         //$mail->SMTPDebug = 2;                               // Enable verbose debug output
         
         $mail->isSMTP();                                      // Set mailer to use SMTP
         $mail->Host = 'mail.bitclubtradingnet.com';  // Specify main and backup SMTP servers
         $mail->SMTPAuth = true;                               // Enable SMTP authentication
         $mail->Username = 'support@bitclubtradingnet.com';                 // SMTP username
         $mail->Password = 'Software@.247';                           // SMTP password
         $mail->SMTPSecure = 'ssl';                            // Enable TLS encryption, `ssl` also accepted
         $mail->Port = 465;                                    // TCP port to connect to
         
         $mail->setFrom('support@bitclubtradingnet.com', 'BITCLUB TRADING');
         $mail->addAddress($to);               // Name is optional
         $mail->addReplyTo('support@bitclubtradingnet.com', 'BITCLUB TRADING');
         //$mail->addCC('cc@example.com');
         //$mail->addBCC('bcc@example.com');
         
         //$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
         //$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
         $mail->isHTML(true);                                  // Set email format to HTML
         
         $mail->Subject = $subject;
         $mail->Body    = $message;
         $mail->send();
         
         header("Location: user-details.php?id=$u_id");

?>