76 lines
3.1 KiB
PHP
Executable File
76 lines
3.1 KiB
PHP
Executable File
<?php
|
|
|
|
if(isset($_POST['name']) && isset($_POST['email']) && isset($_POST['number']) && isset($_POST['comment'])){
|
|
$name=$_POST['name'];
|
|
$email=$_POST['email'];
|
|
$number=$_POST['number'];
|
|
$comment=$_POST['comment'];
|
|
|
|
// HTML Email Content with Improved Styling
|
|
$html = "
|
|
<div style='font-family: Arial, sans-serif; max-width: 600px; margin: auto; border: 1px solid #ddd; padding: 15px; background-color: #ffffff;'>
|
|
<h2 style='background: linear-gradient(45deg, #2E7D32, #4CAF50); color: #fff; margin: 0; text-align: center; padding: 15px;'>New Contact Inquiry</h2>
|
|
|
|
<table style='width: 100%; border-collapse: collapse; margin-top: 10px; border: 1px solid #ddd;'>
|
|
<tr>
|
|
<td style='padding: 12px; background-color: #f8f8f8; border-right: 1px solid #ddd; border-bottom: 1px solid #ddd; font-weight: bold;'>Name:</td>
|
|
<td style='padding: 12px; border-bottom: 1px solid #ddd;'>$name</td>
|
|
</tr>
|
|
<tr>
|
|
<td style='padding: 12px; background-color: #f8f8f8; border-right: 1px solid #ddd; border-bottom: 1px solid #ddd; font-weight: bold;'>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; background-color: #f8f8f8; border-right: 1px solid #ddd; border-bottom: 1px solid #ddd; font-weight: bold;'>Number:</td>
|
|
<td style='padding: 12px; border-bottom: 1px solid #ddd;'>$number</td>
|
|
</tr>
|
|
<tr>
|
|
<td style='padding: 12px; background-color: #f8f8f8; 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 Contact 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", "LeafLine"); // (Your Mail) An email address that will receive the email with the output of the form
|
|
|
|
$mail->IsHTML(true); // Set email format to HTML
|
|
|
|
$mail->Subject = "(LeafLine) New Contact Info";
|
|
$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="Sent Successfully";
|
|
}else{
|
|
//echo "Error occur";
|
|
$msg="Error Occur";
|
|
}
|
|
echo $msg;
|
|
}
|
|
?>
|