PHP email
$title = 'Nova simulação via website';
$headers = "MIME-Version: 1.1\n".
"Content-type: text/html; charset=utf-8\n".
"Content-Transfer-Encoding: 8bit\n".
"From: ". $_POST['clientName'] ." <". $_POST['clientEmail'] .">\n".
"Reply-to: ". $_POST['clientName'] ." <". $_POST['clientEmail'] .">\n".
"Date: ". date( "r" ). "\n";
$values = $_POST['values'];
$rows = '';
if (count($values) > 0) {
for( $i = 0; $i < count( $values ); $i++ ) {
$rows .= '<tr>
<td style="width: 200px; font-weight: bold; border: 1px solid #eee; padding: 10px;">'. $values[$i]['name'] .'</td>
<td style="border: 1px solid #eee; padding: 10px;">'. $values[$i]['value'] .'</td>
</tr>';
}
$content = '<table style="width: 600px; font-size: 11px; border-collapse: collapse;">'. $rows .'</table>';
$result = mail(
OWNER_EMAIL,
"=?UTF-8?B?". base64_encode( $title ) ."?=",
$content,
$headers
);}
JS email
$(".send-quote").click(function() {
var a = $(this).parent(),
b = a.parent().parent(),
d = (b.data("quote-form-for"), {}),
f = "",
g = "",
h = "",
i = "",
j = !1;
a.find(".quote-form-element").each(function(a) {
f = $(this).attr("name"), "undefined" != typeof f && f !== !1 || (f = $(this).data("name")), $(this).hasClass("checkbox") ? g = "yes" == $(this).data("checked") ? $(this).children(".checkbox-values").children(".checkbox-value-checked").text() : $(this).children(".checkbox-values").children(".checkbox-value-unchecked").text() : (g = $(this).is("input") || $(this).is("select") ? $(this).val() : $(this).text(), $(this).is("input") && "" == g || $(this).is("select") && "-" == g ? (j = !0, $(this).addClass("error")) : $(this).removeClass("error")), $(this).hasClass("quote-form-client-name") && (h = $(this).val()), $(this).hasClass("quote-form-client-email") && (i = $(this).val()), d[a] = {
name: f,
value: g
}, a++
}), 0 == j && $.ajax({
url: "_assets/submit.php",
data: {
send: "quote-form",
values: d,
clientName: h,
clientEmail: i
},
type: "post",
success: function(b) {
a.children(".quote-form-thanks").fadeIn(300)
}
})
}), $(".quote-form-thanks-close").click(function() {
var a = $(this).parent().parent();
a.fadeOut(300)
}),
Após enviar o formulário, ele redireciona para o `insert.php.