first commit

This commit is contained in:
2024-03-15 16:26:27 +05:30
commit 381106cbe5
1046 changed files with 285998 additions and 0 deletions
+633
View File
@@ -0,0 +1,633 @@
<?php
header("Access-Control-Allow-Origin: *");
// Only process POST reqeusts.
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get the form fields and remove whitespace.
$first_name = strip_tags(trim($_POST["name"]));
$first_name = str_replace(array("\r","\n"),array(" "," "),$first_name);
$email = filter_var(trim($_POST["email"]), FILTER_SANITIZE_EMAIL);
$subject = trim($_POST["subject"]);
// $phone = trim($_POST["number"]);
$message = trim($_POST["contactMessage"]);
// Check that data was sent to the mailer.
if ( empty($first_name) OR empty($message) OR !filter_var($email, FILTER_VALIDATE_EMAIL)) {
// Set a 400 (bad request) response code and exit.
http_response_code(400);
echo "Please complete the form and try again.";
exit;
}
// Set the recipient email address.
$recipient = "mailcheck@whizthemes.com";
// Set the email subject.
$subject = "Ketab - Mail From $first_name";
// Build the email content.
$email_content =
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Contact Mail</title>
<!--[if (mso)|(mso 16)]>
<style type="text/css">
body, table, td, a, span { font-family: Arial, sans-serif !important; }
a {text-decoration: none !important;}
</style>
<![endif]-->
<style type="text/css">
/* CLIENT-SPECIFIC STYLES */
body,
table,
td,
a {
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
table,
td {
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
}
img {
-ms-interpolation-mode: bicubic;
}
/* RESET STYLES */
img {
border: 0;
outline: none;
text-decoration: none;
}
table {
border-collapse: collapse !important;
}
body {
color: #626160!important;
font-family: Tahoma, Arial, sans-serif !important;
font-size: 14px;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
}
h1,
h2,
h3,
h4,
h5,
h6,
p,
img {
margin: 0;
padding: 0;
}
/* iOS BLUE LINKS */
a[x-apple-data-detectors] {
color: inherit !important;
text-decoration: none !important;
font-size: inherit !important;
font-family: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
}
/* ANDROID CENTER FIX */
div[style*="margin: 16px 0;"] {
margin: 0 !important;
}
/* MEDIA QUERIES */
@media all and (max-width:639px) {
.wrapper {
width: 320px!important;
padding: 0 !important;
}
.container {
width: 300px!important;
padding: 0 !important;
}
.mobile {
width: 300px!important;
display: block!important;
padding: 0 !important;
}
.img {
width: 100% !important;
height: auto !important;
}
*[class="mobileOff"] {
width: 0px !important;
display: none !important;
}
*[class*="mobileOn"] {
display: block !important;
max-height: none !important;
}
}
/*===========================
Author Custom Style
============================*/
hr{
border-color: #fefefe;
border-width: 1px;
margin-bottom: 10px;
}
.message-content{
font-size: 16px;
line-height: 1.6;
}
.content-wrapper h2{
font-weight: 400;
font-size: 20px;
}
.email-txt a{
color: #222222 !important;
text-decoration: none !important;
}
</style>
</head>
<body style="margin:0; padding:0; background-color:#F3F3F3;">
<center>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F2F2F2">
<tr>
<td height="100" style="font-size:10px; line-height:10px;">&nbsp;</td>
</tr>
<tr>
<td align="center" valign="top">
<!--== TemplateContainer Start ==-->
<table width="640" cellpadding="0" cellspacing="0" border="0" class="wrapper" bgcolor="#FFFFFF">
<tr>
<td height="60" style="font-size:10px; line-height:10px;">&nbsp;</td>
</tr>
<!--== Content Area Start ==-->
<tr class="content-wrapper">
<td align="center" valign="top">
<table width="560" cellpadding="0" cellspacing="0" border="0" class="container">
<!--== Start Name Field Item ==-->
<tr>
<td width="100%" class="mobile" align="left" valign="middle">
<h3>Name:</h3>
<hr>
<h2>' . $first_name. '</h2>
</td>
</tr>
<!--== End Name Field Item ==-->
<!--== Start Separator ==-->
<tr>
<td height="30" style="font-size:10px; line-height:10px;">&nbsp;</td>
</tr>
<!--== End Separator ==-->
<!--== Start Email Field Item ==-->
<tr>
<td width="100%" class="mobile" align="left" valign="middle">
<h3>Email:</h3>
<hr>
<h2 class="email-txt">'. $email .'</h2>
</td>
</tr>
<!--== Start Email Field Item ==-->
<!--== Start Separator ==-->
<tr>
<td height="30" style="font-size:10px; line-height:10px;">&nbsp;</td>
</tr>
<!--== End Separator ==-->
<!--== Start Phone Field Item ==-->
// <tr>
// <td width="100%" class="mobile" align="left" valign="middle">
// <h3>Phone or Mobile:</h3>
// <hr>
// <h2>'. $phone .'</h2>
// </td>
// </tr>
<!--== End Phone Field Item ==-->
<!--== Start Separator ==-->
<tr>
<td height="30" style="font-size:10px; line-height:10px;">&nbsp;</td>
</tr>
<!--== End Separator ==-->
<!--== Start Subject Field Item ==-->
<tr>
<td width="100%" class="mobile" align="left" valign="middle">
<h3>Subject:</h3>
<hr>
<h2>'. $subject .'</h2>
</td>
</tr>
<!--== End Subject Field Item ==-->
<!--== Start Separator ==-->
<tr>
<td height="30" style="font-size:10px; line-height:10px;">&nbsp;</td>
</tr>
<!--== End Separator ==-->
<!--== Start Message Field Item ==-->
<tr>
<td width="100%" class="mobile" align="left" valign="middle">
<h3>Message:</h3>
<hr>
<p class="message-content">'. $message .'</p>
</td>
</tr>
<!--== End Message Field Item ==-->
</table>
</td>
</tr>
<!--== Content Area End ==-->
<tr>
<td height="60" style="font-size:10px; line-height:10px;">&nbsp;</td>
</tr>
</table>
<!--== TemplateContainer End ==-->
</td>
</tr>
<tr>
<td height="20" style="font-size:10px; line-height:10px;">&nbsp;</td>
</tr>
<tr>
<td align="center" valign="top">
<a href="https://hasthemes.com/" target="_blank"><img width="120" src="https://hasthemes.com/wp-content/uploads/2019/01/1.png" alt="HasThemes"></a>
</td>
</tr>
<tr>
<td height="100" style="font-size:10px; line-height:10px;">&nbsp;</td>
</tr>
</table>
</center>
</body>
</html>';
// Build the email headers.
$email_headers = "MIME-Version: 1.0" . "\r\n";
$email_headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$email_headers .= 'From:' . $first_name . ' ' . 'noreply@yourdomain.com' . "\r\n";
$email_headers .= 'Reply-To:' . $email . "\r\n";
// Send the email.
if (mail($recipient, $subject, $email_content, $email_headers)) {
// Set a 200 (okay) response code.
http_response_code(200);
echo "Thank You! Your message has been sent.";
} else {
// Set a 500 (internal server error) response code.
http_response_code(500);
echo "Oops! Something went wrong and we couldn't send your message.";
}
} else {
// Not a POST request, set a 403 (forbidden) response code.
http_response_code(403);
echo "There was a problem with your submission, please try again.";
}
?>
+70
View File
@@ -0,0 +1,70 @@
<?php
error_reporting(1);
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\OAuth;
require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
require 'PHPMailer/src/OAuth.php';
$mail = new PHPMailer(true);
//Server settings
// $mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
$mail->isSMTP(); //Send using SMTP
$mail->Host = 'ssl://smtp.gmail.com'; //Set the SMTP server to send through
$mail->SMTPAuth = true; //Enable SMTP authentication
$mail->Username = 'rahulkatari99@gmail.com'; //SMTP username
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
// $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
$mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
//Recipients
$mail->setFrom('rahulkatari99@gmail.com', 'rahul Sales');
$mail->addAddress('rahulkatari99@gmail.com', 'rahul'); //Add a recipient
//$mail->addAddress('ellen@example.com'); //Name is optional
$mail->addReplyTo('rahulkatari99@gmail.com', 'reply-to-rahul');
//$mail->addCC('cc@example.com');
//$mail->addBCC('bcc@example.com');
//Attachments
// $mail->addAttachment('/var/tmp/file.tar.gz'); //Add attachments
// $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); //Optional name
//Send HTML or Plain Text email
$mail->isHTML(true);
if(!empty($_POST['email'])){
$companyName=$_POST['companyName'];
$contactName=$_POST['contactName'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$subject=$_POST['subject'];
$message=$_POST['message'];
}
$body = "<table><tbody>";
$body .= "<tr><td style='padding:5px 10px;background-color:#F0C500;color:#fff;border-bottom:1px solid #fff;'>Company Name </td><td style='padding:5px 10px;background-color:#DDDDDD;color:#000;border-bottom:1px solid #fff;'>$companyName</td></tr>";
$body .= "<tr><td style='padding:5px 10px;background-color:#F0C500;color:#fff;border-bottom:1px solid #fff;'>Contact Person</td><td style='padding:5px 10px;background-color:#DDDDDD;color:#000;border-bottom:1px solid #fff;'>$contactName</td></tr>";
$body .= "<tr><td style='padding:5px 10px;background-color:#F0C500;color:#fff;border-bottom:1px solid #fff;'>Email</td><td style='padding:5px 10px;background-color:#DDDDDD;color:#000;border-bottom:1px solid #fff;'>$email</td></tr>";
$body .= "<tr><td style='padding:5px 10px;background-color:#F0C500;color:#fff;border-bottom:1px solid #fff;'>Phone</td><td style='padding:5px 10px;background-color:#DDDDDD;color:#000;border-bottom:1px solid #fff;'>$phone</td></tr>";
$body .= "<tr><td style='padding:5px 10px;background-color:#F0C500;color:#fff;border-bottom:1px solid #fff;'>Subject</td><td style='padding:5px 10px;background-color:#DDDDDD;color:#000;border-bottom:1px solid #fff;'>$subject</td></tr>";
$body .= "<tr><td style='padding:5px 10px;background-color:#F0C500;color:#fff;border-bottom:1px solid #fff;'>Message</td><td style='padding:5px 10px;background-color:#DDDDDD;color:#000;border-bottom:1px solid #fff;'>$message</td></tr>";
$body .= "</tbody></table>";
$mail->Subject = "Contact From $contactName";
$mail->Body = $body;
// $mail->AltBody = "This is the plain text version of the email content";
try {
$mail->send();
echo 1;
} catch (Exception $e) {
echo "Mailer Error: " . $mail->ErrorInfo;
}
?>