<?php
$txtfirstname= $_REQUEST[name];
$from= $_REQUEST[email];
$txttelephone= $_REQUEST[telephone];
$txtComments= $_REQUEST[comments];
$subject = "Online Enquiry";
$to="info@xxxxxxxxxx.com";
$message="Name: ".$txtfirstname."\n\nEmail Id: ".$from."\n\nTelephone: ".$txttelephone."\n\n";
if($txtComments)
$message.="Comments: ".$txtComments."\n\n";
$host = "smtp.bizmail.yahoo.com";
$port = "465";
$username = "info@xxxxxxxxxx.com";
$password = "xxxxxxxx";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $message);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
header( "Location: thanks.html");
} else {
echo("<p>Message successfully sent!</p>");
header( "Location: thanks.html");
}
?>