I have a contact form that is not clearing after submit and going to junk folder. The emails hit the junk folder from [email protected]
my html form looks like this:
Код: Выделить всё
Submit Now Reset
Код: Выделить всё
(function($) { $("#contact_form").validate({ submitHandler: function(form) { var form_btn = $(form).find('button[type="submit"]'); var form_result_div = '#form-result'; $(form_result_div).remove(); form_btn.before(''); var form_btn_old_msg = form_btn.html(); form_btn.html(form_btn.prop('disabled', true).data("loading-text")); $(form).ajaxSubmit({ dataType: 'json', success: function(data) { if( data.status == 'true' ) { $(form).find('.form-control').val(''); } form_btn.prop('disabled', false).html(form_btn_old_msg); $(form_result_div).html(data.message).fadeIn('slow'); setTimeout(function(){ $(form_result_div).fadeOut('slow') }, 800); } }); } }); })(jQuery);
Код: Выделить всё
?php if( $_SERVER['REQUEST_METHOD'] == 'POST' ) { // Multiple recipients $to = 'someemail.com'; $name = $_POST['form_name']; $email = $_POST['form_email']; $subject = $_POST['form_subject']; $phone = $_POST['form_phone']; $message = $_POST['form_message']; $referrer = $_SERVER['HTTP_REFERER'] ? '
This Form was submitted from: ' . $_SERVER['HTTP_REFERER'] : ''; $name = isset($name) ? "Name: $name
" : ''; $email = isset($email) ? "Email: $email
" : ''; $phone = isset($phone) ? "Phone: $phone
" : ''; $message = isset($message) ? "Message: $message
" : ''; $subject = isset($subject) ? $subject : 'New Message | Contact Form'; $from = $email ; // Message $message = "$name $email $phone $message $referrer"; // To send HTML mail, the Content-type header must be set $headers[] = 'MIME-Version: 1.0'; $headers[] = 'Content-type: text/html; charset=iso-8859-1'; $headers[] = "From: $from"; // Mail it mail($to, $subject, $message, implode("\r\n", $headers)); } ?>
Источник: https://stackoverflow.com/questions/781 ... ng-to-junk