I making contact using php, Now the PHPMailer is working properly.
My problem is, How to call the value from one page to other page and here my code.
Contact.php
My contact page is once the user click the submit button they going to send a email to the admin with the email_HTMLTemplate.php and here my code of the HTMLTemplate.php I could not right all the code because it's to long and here the main part of the code.
email_HTMLTemplate.php
MY PROBLEM:
I want to call the string value of
from Contact.php to my email_HTMLTemplate.php
.
My problem is, How to call the value from one page to other page and here my code.
Contact.php
PHP:
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require './mail/mail-src/Exception.php';
require './mail/mail-src/PHPMailer.php';
require './mail/mail-src/SMTP.php';
$page_content = file_get_contents('./mail/email_HTMLTemplate.php');
$mail = new PHPMailer(true);
$mail -> isSMTP();
$mail -> Host = 'smtp.gmail.com';
$mail -> SMTPAuth = true;
//sender info
$mail -> Username = 'sample@gmail.com';
$mail -> Password = 'pass0987';
$mail -> SMTPSecure = 'ssl';
$mail -> Port = 465;
$mail -> setFrom($c_email);
$mail -> addAddress('sample_admin@gmail.com');
$mail -> isHTML(true);
//$mail -> Subject = ('User_Inquiry');
$email_subject = 'User_Inquiry';
$mail -> Subject = $email_subject;
$mail-> Body = $page_content;
$mail ->send();
$succ = "success";
My contact page is once the user click the submit button they going to send a email to the admin with the email_HTMLTemplate.php and here my code of the HTMLTemplate.php I could not right all the code because it's to long and here the main part of the code.
email_HTMLTemplate.php
HTML:
<!doctype html>
<html>
<?php include('contact.php');?>
<head>
<!--<![sample only]-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body style="background-color:#f9f9f9;">
<tr>
<td align="center" style="font-size:0px;padding:10px 25px;padding-bottom:40px;word-break:break-word;">
<div style="font-family:'Helvetica Neue',Arial,sans-serif;font-size:32px;font-weight:bold;line-height:1;text align:center;color:#555;">
<!--STRING VARIABLE HERE-->
<?php echo $email_subject;?>
</div>
</td>
</tr>
</body>
</html>
MY PROBLEM:
I want to call the string value of
PHP:
$mail -> Subject = ('User Inquiry');
PHP:
<?php echo $email_subject;?>