note 77441 rejected from ref.mail by cece
| From: | cece@php.net | Date: | Fri, 31 Aug 2007 12:02:11 +0000 |
| Subject: | note 77441 rejected from ref.mail by cece | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-129938@lists.php.net to get a copy of this message | ||
Note Submitter: info at traveletto dot com
----
the mail is only sent to info@traveletto.com, not to the contact_email. What have i done wrong ?
<?php
require_once( GLOBAL_ROOT . 'DB/Database.class.php' );
require_once( SMARTY_CLASS );
require_once( GLOBAL_ROOT . '_smarty.php');
require_once( GLOBAL_ROOT . '_db_start.php');
$object_id = $_GET[ 'object_id' ];
$contact_info = $dbObj->query( 'SELECT object.name AS object_name, object_type.name AS
object_type_name, contact_firstname, contact_lastname, contact_email, contact_phone_1,
contact_phone_2
FROM object
JOIN object_type ON object.object_type_id = object_type.object_type_id
WHERE object_id = ' . $object_id . ';' );
$smarty->assign( 'contact_info', $contact_info );
/**
* assign pagerelated info to fill in <title></title>
*/
$smarty->assign('title', 'Book now - Traveletto.com');
/**
* no mail is sent by default
*/
$smarty->assign( 'mail_sent', false );
/**
* send mail
*/
if( isset( $_GET[ 'send' ] )){
while ($row = mysql_fetch_assoc($contact_info)) {
$tmp_str= $row['object_id'];
}
$strName = $_POST[ 'txtName' ];
$strEmail = $_POST[ 'txtEmail' ];
$strTelephone = $_POST[ 'txtTelephone' ];
$strSubject = 'Traveletto.com - Inquiry regarding object ' . $contact_info[
'object_name' ];
// Fix
$strLengtOfStay = $_POST[ 'lenght_of_stay' ];
$strNumberOfGuests = $_POST[ 'number_of_guests' ];
$strYear = $_POST[ 'year' ];
$strMonth = $_POST[ 'month' ];
$strDay = $_POST[ 'day' ];
// end of Fix
$strMessage = $_POST[ 'areaMessage' ];
if($strName == ""){
echo("<b>Must enter a name</b>");
exit;
}
if($strEmail == "") {
$strEmail = "none";
}
if($_POST[ 'areaMessage' ] == ""){
echo("<b>Must enter a message</b>");
exit;
}
$strMessage = "Name: ".$strName."\r\n";
$strMessage .= "Email: ".$strEmail."\r\n";
$strMessage .= "Length of stay: ".$strLengtOfStay."\r\n";
$strMessage .= "Number of Guests: ".$strNumberOfGuests."\r\n";
$strMessage .= "Date:
".$strDay."-".$strMonth."-".$strYear."\r\n\r\n";
$strMessage .= $_POST[ 'areaMessage' ];
$strHeaders = "MIME-Version: 1.0\r\n";
$strHeaders .= "Content-type: text/html; charset=iso-8859-1\r\n";
$strHeaders .= "From: " . $strName . "<". $strEmail . ">\r\n";
$strHeaders .= "Reply-To:" . $contact_email;
$strHeaders .= "Reply-To: info@traveletto.com";
$to_str=$contact_email. ' , info@traveletto.com ';
if( mail( $to_str, $strSubject, $strMessage, $strHeaders ) ) {
$smarty->assign( 'mail_sent', true );
}
}
$smarty->display('book_now.tpl');
require_once( GLOBAL_ROOT . '_db_end.php');
?>