Hi,
I need help,I created contact form and I wrote email sending coding also,but the coding is not working.This is the coding that I have wrote.Please clear me what's the mistake....
<?php
include "functions/libmail.php";
if (isset($_POST['Submit'])){
extract($_POST);
$ErrNo = 0;
$Name = $_POST['name'];
$Email = $_POST['email'];
$Company = $_POST['company'];
if ($Name == ''){
$ErrNo = 1;
$Err[] = 'Please enter name.';
}
if ($Email == ''){
$ErrNo = 1;
$Err[] = 'Please enter email id.';
}
if ($Company == ''){
$ErrNo = 1;
$Err[] = 'Please enter company name.';
}
if ($ErrNo == 0){
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$Email))
{
$ErrNo = 1;
$Err[] = 'Please enter valid email address.';
}
}
if ($ErrNo == 0){
$Phone = trim($_POST['phoneno']);
$Content = trim($_POST['comment']);
$Web = trim($_POST['website']);
$Address = trim($_POST['address']);
$file = "contact.html";
$fh = fopen($file, 'r+');
$contents = fread($fh, filesize($file));
$contents = str_replace("XXXNAMEXXX", $Name, $contents);
$contents = str_replace("XXXCOMPANYXXX", $Company, $contents);
$contents = str_replace("XXXADDRESSXXX", $Address, $contents);
$contents = str_replace("XXXEMAILXXX", $Email, $contents);
$contents = str_replace("XXXPHONEXXX", $Phone, $contents);
$contents = str_replace("XXXWEBXXX", $Web, $contents);
$contents = str_replace("XXXCONTENTXXX", $Content, $contents);
$m= new Mail(); // create the mail
$m->From($Email);
$m->To("setvaz102@gmail.com");
$m->Subject("Setvaz Enquiry Mail");
$m->Body($contents); // set the body
//$m->Cc( "someone@somewhere.fr");
//$m->Bcc( "someoneelse@somewhere.fr");
//$m->Priority(4) ; // set the priority to Low
//$m->Attach( "/home/leo/toto.gif", "image/gif" ) ; // attach a file of type image/gif
if($m->Send()){
$ErrNo = 1;
$Err[] = 'Mail Sent Successfully';
}
else{
$ErrNo = 1;
$Err[] = 'Mail Sent Failed. Please resend again';
}
fclose($fh);
}
}
?>