php - Mail from contact form without date -



php - Mail from contact form without date -

after many trials , errors got php contact form working way want, sending right info hosting mail service address. , appears except date, doesn't appear @ (on inbox). contacted hosting service didn't replied. i've went researching php manual there's no info date atribute/header. knows how prepare this?

here php:

<?php if(isset($_post['email'])) { foreach( $_post $value ){ if( stripos($value,'content-type:') !== false ){ echo "there seems wrong information. please seek again."; exit; } } if ($_post["morada"] != "") { echo "oops! error. please seek again."; exit; } // edit 2 lines below required $email_to = "main@myemailaccount.com"; $email_subject = "contact form"; // validation expected info exists if(!isset($_post['nome']) || !isset($_post['email']) || !isset($_post['phone']) || !isset($_post['website']) || !isset($_post['motivo']) || !isset($_post['mensagem'])) { died('we sorry, there appears problem form submitted.'); } $nome = $_post['nome']; // required $email = $_post['email']; // required $phone = $_post['phone']; // required $website = $_post['website']; // not required $motivo = $_post['motivo']; // required $mensagem = $_post['mensagem']; // required $error_message = ""; $email_message = "form details below.<br><br>"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); homecoming str_replace($bad,"",$string); } $email_message .= "nome: ".clean_string($nome)."<br>"; $email_message .= "email: ".clean_string($email)."<br>"; $email_message .= "telefone: ".clean_string($phone)."<br>"; $email_message .= "website: ".clean_string($website)."<br>"; $email_message .= "motivo: ".clean_string($motivo)."<br>"; $email_message .= "mensagem: ".clean_string($mensagem)."<br><br><br><br>"; $email_message = wordwrap($email_message, 70); // create email headers $headers = ""; $headers .= 'from: '.$nome.'<'.$email.'>'.$eol; $headers .= 'reply-to: '.$nome.'<'.$email.'>'.$eol; $headers .= 'return-path: '.$nome.'<'.$email.'>'.$eol; $headers .= "x-mailer: php v".phpversion().$eol; $headers .= 'mime-version: 1.0'.$eol; $headers .= "content-type: text/html; charset=utf-8".$eol; @mail($email_to, $email_subject, $email_message, $headers); { echo header("location: thanks.html"); }} ?>

don't have server configured mailing engine can't test it. think need add together 'date' header:

$headers .= 'date: '.date('r').$eol;

you might want configure default time zone:

date_default_timezone_set("utc");

http://il1.php.net/manual/en/function.date-default-timezone-set.php

php email date contact-form

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -