if remove $headers mail function working , send $message html code included in mail instead of showing table, when include $headers in mail function,it doesnt send mails.it doesnt show error.here's code.im on working on web server.
<?php //deal email if(isset($_post['submit'])) { $to = 'myemail@example.com'; $title = 'new enquiry || example.com'; $subject = $_post['subject']; $message = $_post['message']; $name = $_post['name']; $email = $_post['email']; } $headers .= "from: " . strip_tags($email) . "\r\n"; $headers .= 'mime-version: 1.0' . "\r\n"; $headers .= 'content-type: text/html; charset=iso-8859-1' . "\r\n"; $msg = '<html><head><body><b>'.$title.'</b> <br> <table bgcolor=#cccccc> <tr> <td> subject : </td> <td> '.$subject.'</td></tr>' .'<tr> <td> contact person: </td><td>'.$name.'</td></tr>' .'<tr> <td> e-mail:</td><td> '.$email.'</td></tr>' .'<tr><td> message : </td><td>'.$message.' </td></tr></table></body></head></html>'; mail($to, $title, $subject, $msg, $headers); header( "refresh:1;url=contact-us-ok.html" ); ?>
the mail function defined as:
bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
from: http://php.net/manual/en/function.mail.php
you sending:
mail($to, $title, $subject, $msg, $headers);
it looks sending $title variable when shouldn't be.
Comments
Post a Comment