Thursday, September 29, 2011

problem sending email.

I have contact us page on my website here the php code for sending the
email:
<?php
header("refresh: 5; contact.html");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-8" />
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<div class="mailform">
<?php
if(isset($_POST['Email'])) {

// CHANGE THE TWO LINES BELOW
$email_to = "info@mywebsite";

$email_subject = "Contact Form";

$fullname = $_POST['Name'];
$phone = $_POST['Phone'];
$altphone = $_POST['AltPhone'];
$email_from = $_POST['Email'];
$subject = $_POST['Subject'];
$message = $_POST['MoreInfo'];


$email_message = "Form details below.\n\n";

function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}

$email_message .= "Full Name: ".clean_string($fullname)."\n";
$email_message .= "Phone: ".clean_string($phone)."\n";
$email_message .= "Alternative Phone: ".clean_string($altphone)."\n";
$email_message .= "Subject: ".clean_string($subject)."\n";
$email_message .= "Message: ".clean_string($message)."\n";


// create email headers
$headers = 'From : '.$email_from."\r\n".
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>

<!-- place your own success html below -->

<p>����� ������</p>
<span> ����� ���� ��� ������</span>

<?php
}
die();
?>
</div>
</html>
___________________________________________________

somehow this doesn't work. It doesn't send the emails.

Where is the problem in this code?

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: