| Current Path : /var/www/html/nadineandmiabeauty/mail/ |
| Current File : /var/www/html/nadineandmiabeauty/mail/sendmail.php |
<?php
require_once('../admin/autoload.php');
$db = new pdocrudhandler();
$config = config::getAppConfig();
$userdata = [
'name'=> $_POST['username'],
'email'=>$_POST['useremail'],
'subject'=>$_POST['usersubject'],
'message'=>$_POST['message'],
'datetime'=>date('Y-m-d h:i:s')
];
$res = $db->insert($config['table']['contactus'],$userdata);
//echo "<pre>"; print_r($res);exit;
successEmailTemplate($_POST['username'],$_POST['useremail'],$_POST['usersubject'],$_POST['message']);
//error_log(var_export($_POST,true),3,'/email.log');
function successEmailTemplate($name,$address,$subject = '',$message){
date_default_timezone_set('America/New_York');
if($subject == ''){
$subject = 'Message received from http://nadineandmiabeauty.com';
}
$emailsubject = 'Message received from http://nadineandmiabeauty.com';
$to = "abdulmoiz.baig.work@gmail.com, samia_astro@hotmail.com";
$headers = "From: contact-us@nadineandmiabeauty.com\r\n";
$headers .= "Reply-To: noreply@nadineandmiabeauty.com\r\n";
//$headers .= "CC: abdulmoiz.baig.work@gmail.com\r\n";
//$headers .= "BCC: abdulmoiz.baig.work@gmail.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$message = '<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Meraj Sons Email</title>
<!-- Designed by https://github.com/kaytcat -->
<!-- Header image designed by Freepik.com -->
<style type="text/css">
/* Take care of image borders and formatting */
img {
max-width: 600px;
outline: none;
text-decoration: none;
-ms-interpolation-mode: bicubic;
}
a img { border: none; }
table { border-collapse: collapse !important; }
#outlook a { padding:0; }
.ReadMsgBody { width: 100%; }
.ExternalClass {width:100%;}
.backgroundTable {margin:0 auto; padding:0; width:100%;}
table td {border-collapse: collapse;}
.ExternalClass * {line-height: 115%;}
/* General styling */
td {
font-family: Arial, sans-serif;
color: #6f6f6f;
}
body {
-webkit-font-smoothing:antialiased;
-webkit-text-size-adjust:none;
width: 100%;
height: 100%;
color: #6f6f6f;
font-weight: 400;
font-size: 18px;
}
h1 {
margin: 10px 0;
}
a {
color: #27aa90;
text-decoration: none;
}
.force-full-width {
width: 100% !important;
}
.force-width-80 {
width: 80% !important;
}
.body-padding {
padding: 0 75px;
}
.mobile-align {
text-align: right;
}
</style>
<style type="text/css" media="screen">
@media screen {
@import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,900);
/* Thanks Outlook 2013! */
* {
font-family: \'Source Sans Pro\', \'Helvetica Neue\', \'Arial\', \'sans-serif\' !important;
}
.w280 {
width: 280px !important;
}
}
</style>
<style type="text/css" media="only screen and (max-width: 480px)">
/* Mobile styles */
@media only screen and (max-width: 480px) {
table[class*="w320"] {
width: 320px !important;
}
td[class*="w320"] {
width: 280px !important;
padding-left: 20px !important;
padding-right: 20px !important;
}
img[class*="w320"] {
width: 250px !important;
height: 67px !important;
}
td[class*="mobile-spacing"] {
padding-top: 10px !important;
padding-bottom: 10px !important;
}
*[class*="mobile-hide"] {
display: none !important;
}
*[class*="mobile-br"] {
font-size: 12px !important;
}
td[class*="mobile-w20"] {
width: 20px !important;
}
img[class*="mobile-w20"] {
width: 20px !important;
}
td[class*="mobile-center"] {
text-align: center !important;
}
table[class*="w100p"] {
width: 100% !important;
}
td[class*="activate-now"] {
padding-right: 0 !important;
padding-top: 20px !important;
}
td[class*="mobile-block"] {
display: block !important;
}
td[class*="mobile-align"] {
text-align: left !important;
}
}
</style>
</head>
<body class="body" style="padding:0; margin:0; display:block; background:#fbfbfb; -webkit-text-size-adjust:none;" bgcolor="#fbfbfb">
<table align="center" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top" style="background-color:#fbfbfb" width="100%">
<center>
<table cellspacing="0" cellpadding="0" width="600" class="w320">
<tr>
<td align="center" valign="top">
<table cellspacing="0" cellpadding="0" class="force-full-width" style="background-color:#3bcdb0;">
<tr>
<td style="background-color:#3bcdb0;">
<table cellspacing="0" cellpadding="0" class="force-full-width">
<tr>
<td style="font-size:24px; font-weight: 600; color: #ffffff; text-align:center;" class="mobile-spacing">
<div class="mobile-br"> </div>
'.$subject.'
<br/>
</td>
</tr>
<!--<tr>
<td style="font-size:24px; text-align:center; padding: 0 75px; color: #6f6f6f;" class="w320 mobile-spacing">
From your website nadineandmiabeauty.com
</td>
</tr>-->
</table>
<table cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" class="force-full-width" bgcolor="#ffffff" >
<tr>
<td style="background-color:#ffffff; padding-top: 15px;">
<center>
<table style="margin:0 auto;" cellspacing="0" cellpadding="0" class="force-width-80">
<tr>
<td style="text-align:left;">
<br>
<strong>Name:</strong> '.$name.'<br>
<strong>Email:</strong> '.$address.'<br>
</td>
<td style="text-align:right; vertical-align:top;">
<br>
<b>Date/Time</b>
<br>
'.date("F j, Y, g:i a").'
</td>
</tr>
</table>
</center>
<center>
<table style="margin:0 auto; margin-top: 20px;" cellspacing="0" cellpadding="0" class="force-width-80">
<tr>
<td style="text-align:left;">
<strong>Message:</strong> '.$message.'
</td>
</tr>
</table>
</center>
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>
</td>
</tr>
</table>
</body>
</html>
';
$mail = mail($to, $emailsubject, $message, $headers);
// echo "to: ".$to."<br>";
// echo "subject: ".$subject."<br>";
// echo "message: ".$message."<br>";
// echo "headers: ".$headers."<br>";
// echo json_encode($mail);
// exit;
if($mail){
header('location:../contactus.php?success');
}else{
header('location:../contactus.php?failed');
}
}
?>