Email Issues

<?php session_start(); include("includes/db.php"); include("includes/common.php"); $dbconn=mysql_connect($hostname,$dbusername,$password)or die(mysql_error()); $connection = mysql_select_db($databasename,$dbconn); if(!$connection) { echo "connection failed on the db selection"; } if($_POST['Submit2_x']) { $sql_get_quote_num = "SELECT max(quote_number) as NUM FROM quotes"; $quote_num_result =@mysql_query($sql_get_quote_num); while($row = @mysql_fetch_array($quote_num_result)) { $quote_number = $row['NUM']; } // Add 1 to the existing count $quotenum= $quote_number + 1; $timeadjust = 60 * 60 * 3; $date_time = date("Y-m-d H:i:s",time() + $timeadjust); $site_tag = "www..com"; $insert_new_quote .="INSERT INTO quotes(quote_number,site_tag,date_time_received,number_of_items,items_type,items_length,"; $insert_new_quote .="items_width,items_height,items_commodity,items_class,items_description,first_name,"; $insert_new_quote .="last_name,telephone,email,city_orig,state_orig,zip_orig,country_orig,type_orig,city_dest,"; $insert_new_quote .="state_dest,zip_dest,country_dest,type_dest,total_weight,status,how_found,quote_type) "; $insert_new_quote .= "VALUES('$quotenum','$site_tag','$date_time','".$_POST['itemQuantity']."','".$_POST['itemPackage']."',"; $insert_new_quote .= "'".$_POST['itemLength']."','".$_POST['itemWidth']."','".$_POST['itemHeight']."',"; $insert_new_quote .= "'".$_POST['itemcommodity']."','".$_POST['itemclass']."','".$_POST['description']."',"; $insert_new_quote .= "'".$_POST['fname']."','".$_POST['lname']."','".$_POST['phone']."','".$_POST['Email']."',"; $insert_new_quote .= "'".$_POST['CityOrigin']."','".$_POST['StateOrigin']."','".$_POST['zipOrigin']."',"; $insert_new_quote .= "'".$_POST['CountryOrigin']."','".$_POST['radiogroup1']."','".$_POST['CityDestination']."',"; $insert_new_quote .= "'".$_POST['StateDestination']."','".$_POST['zipDestination']."','".$_POST['CountryDestination']."',"; $insert_new_quote .= "'".$_POST['radiogroup2']."','".$_POST['itemWeight']."','inbox','".$_POST['how_found']."','regular')"; $quote_insert = @mysql_query($insert_new_quote); $to = $_POST['Email']; $fromemail = "[email protected]"; $subject = "Response From Website # " .$quotenum; // Additional headers $headers .= "To: <$to>rn"; $headers .= "From: <$fromemail>rn"; $headers = 'MIME-Version: 1.0' . "rn"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn"; $message = '
Thank you for visiting
 

Your quote has been received and one of our highly trained freight agents is preparing your freight rate now. Remember all quotes are given at the most cost effective prices and for the fastest and most accurate shipping price we ask that you call and speak with one of our helpful agents. When you call, your agent can and will answer any questions you may have, as well as help you with all freighting options available in your respective areas.   is a Continental North American Freight Logistic Company and uses more than 50 major freight carriers. Using our service you will be offered discount freight shipping prices, as well as fast and friendly freight shipping services.

Your discounted freight quote will be emailed to you shortly.

dfr
 
You will be emailed by one of our agents as soon as your quote is ready.
 

Continental North America Freight Logistics     

'; //EOF; $success2 = mail($to, $subject, $message, $headers); if ($success2) { $msg= "Thank you."; $url = "thank_you.php"; confirm($msg,$url); } else { $msg= "Sorry there was a problem sending your quote information."; $url = "quote.php"; confirm($msg,$url); } } ?>

Ok whats happening, when i send out an email with the system it returns [email protected] the actual Servers address. It wont return the email i tell it to, also when click submit it gives an error saying

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/serveraddress/public_html/newtestsite/quote.php:1) in /home/serveraddress/public_html/newtestsite/quote.php on line 4

Can anyone give me an idea why it isnt working right and what im doing wrong?

Thanks

i guess u have a blank or a newline before ‘<?php’

I can’t realy help u if u don’t get any errors. Maybe it is isn’t even an error that can be solved inside PHP. Try to analyse the the eMail-header.
And try error_reporting(E_ALL);

one thing i found. i have never seen the ‘To:’-header been specefied twice. u may remove the $headers .= "To: <$to>rn";-line.

Also,
I noticed in the script that there a few @. This suppresses error messages. Best to leave the out until you are done developing.

You can solve this problem using output control functions .

Using output control functions to buffer the output is a workaround though, not a solution :wink:

Although I’m being slightly hypocritical, as I’m buffering output in variables throughout the script, before flushing it at the end ^_^;;

Sponsor our Newsletter | Privacy Policy | Terms of Service