Files
preview_sites/proposals/mobile-galaxy-gaming/mockup/assets/php/quote.php
T

122 lines
6.0 KiB
PHP
Executable File

<?php
if (
isset($_POST['name']) && isset($_POST['email']) && isset($_POST['number'])
&& isset($_POST['service-type']) && isset($_POST['address']) && isset($_POST['property-type'])
&& isset($_POST['area-size']) && isset($_POST['garden-style']) && isset($_POST['project-urgency'])
) {
// Sanitize user inputs
$name = htmlspecialchars(trim($_POST['name']));
$email = htmlspecialchars(trim($_POST['email']));
$number = htmlspecialchars(trim($_POST['number']));
$serviceType = htmlspecialchars(trim($_POST['service-type']));
$address = htmlspecialchars(trim($_POST['address']));
$propertyType = htmlspecialchars(trim($_POST['property-type']));
$areaSize = htmlspecialchars(trim($_POST['area-size']));
$gardenStyle = htmlspecialchars(trim($_POST['garden-style']));
$projectUrgency = htmlspecialchars(trim($_POST['project-urgency']));
$comment = isset($_POST['comment']) ? htmlspecialchars(trim($_POST['comment'])) : '';
$extraServices = isset($_POST['extra-services']) ? implode(', ', $_POST['extra-services']) : '';
// Styled HTML Email Content
$html = "
<div style='font-family: Arial, sans-serif; max-width: 600px; margin: auto; border: 1px solid #ddd; padding: 12px; background-color: #ffffff;'>
<h2 style='background: linear-gradient(45deg, #2E7D32, #4CAF50); color: #fff; margin: 0; text-align: center; padding: 15px;'>New Career Application</h2>
<table style='width: 100%; border-collapse: collapse; margin-top: 10px; border: 1px solid #ddd;'>
<tr>
<td style='padding: 12px; border-bottom: 1px solid #ddd; font-weight: bold; border-right: 1px solid #ddd;'>Name:</td>
<td style='padding: 12px; border-bottom: 1px solid #ddd;'>$name</td>
</tr>
<tr>
<td style='padding: 12px; border-bottom: 1px solid #ddd; font-weight: bold; border-right: 1px solid #ddd;'>Email:</td>
<td style='padding: 12px; border-bottom: 1px solid #ddd;'><a href='mailto:$email' style='color: #007BFF; text-decoration: none;'>$email</a></td>
</tr>
<tr>
<td style='padding: 12px; border-bottom: 1px solid #ddd; font-weight: bold; border-right: 1px solid #ddd;'>Phone Number:</td>
<td style='padding: 12px; border-bottom: 1px solid #ddd;'>$number</td>
</tr>
<tr>
<td style='padding: 12px; border-bottom: 1px solid #ddd; font-weight: bold; border-right: 1px solid #ddd;'>Servie Type:</td>
<td style='padding: 12px; border-bottom: 1px solid #ddd;'>$serviceType</td>
</tr>
<tr>
<td style='padding: 12px; border-bottom: 1px solid #ddd; font-weight: bold; border-right: 1px solid #ddd;'>Address:</td>
<td style='padding: 12px; border-bottom: 1px solid #ddd;'>$address</td>
</tr>
<tr>
<td style='padding: 12px; border-bottom: 1px solid #ddd; font-weight: bold; border-right: 1px solid #ddd;'>Property Type:</td>
<td style='padding: 12px; border-bottom: 1px solid #ddd;'>$propertyType</td>
</tr>
<tr>
<td style='padding: 12px; border-bottom: 1px solid #ddd; font-weight: bold; border-right: 1px solid #ddd;'>Area Size (sq m):</td>
<td style='padding: 12px; border-bottom: 1px solid #ddd;'>$areaSize</td>
</tr>
<tr>
<td style='padding: 12px; border-bottom: 1px solid #ddd; font-weight: bold; border-right: 1px solid #ddd;'>Garden Style:</td>
<td style='padding: 12px; border-bottom: 1px solid #ddd;'>$gardenStyle</td>
</tr>
<tr>
<td style='padding: 12px; border-bottom: 1px solid #ddd; font-weight: bold; border-right: 1px solid #ddd;'>Project Urgency:</td>
<td style='padding: 12px; border-bottom: 1px solid #ddd;'>$projectUrgency</td>
</tr>";
if (!empty($extraServices)) {
$html .= "
<tr>
<td style='padding: 12px; border-bottom: 1px solid #ddd; font-weight: bold; border-right: 1px solid #ddd;'>Extra Services:</td>
<td style='padding: 12px; border-bottom: 1px solid #ddd;'>$extraServices</td>
</tr>";
}
$html .= "
<tr>
<td style='padding: 12px; font-weight: bold; border-right: 1px solid #ddd;'>Comment:</td>
<td style='padding: 12px;'>$comment</td>
</tr>
</table>
<p style='text-align: center; font-size: 14px; color: #666; margin-top: 20px;'>
<em>Sent via LeafLine Career Application Form</em>
</p>
</div>";
include('smtp/PHPMailerAutoload.php');
$mail=new PHPMailer(true);
// smtp Settings
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host="smtp.gmail.com"; // SMTP servers
$mail->Port=587; //specify SMTP Port
$mail->SMTPSecure="tls"; // Enable TLS encryption, `ssl` also accepted
$mail->SMTPAuth=true; // Enable SMTP authentication
$mail->Username="your_email@gmail.com"; // (SMTP Username) Your Mail
$mail->Password="Your App Password"; // (SMTP Password) Your app password
$mail->setFrom($email, $name);
$mail->addAddress("your_email@gmail.com", "test");
$mail->IsHTML(true); // Set email format to HTML
$mail->Subject = "(LeafLine) Quote Form";
$mail->Body = $html;
$mail->SMTPOptions=array('ssl'=>array(
'verify_peer'=>false,
'verify_peer_name'=>false,
'allow_self_signed'=>false
));
$msg="";
if($mail->send()){
//echo "Mail send";
$msg="Form submitted successfully!";
}else{
//echo "Error occur";
$msg="Error Occur";
}
echo $msg;
}
?>