You are here: Re: not receiving emails expected « PHP Programming Language « IT news, forums, messages
Re: not receiving emails expected

Posted by Jerry Stuckle on 10/02/07 02:52

davjoh wrote:
> On Sep 30, 9:00 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> davjohwrote:
>>> On Sep 30, 11:01 am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> It could. But more importantly, where is the data coming from? and
>> what does it look like there?
>>
>
> The data is hard coded into the file
>
> $send_to[] = "davjoh...@yahoo.com";
> $send_to[] = "product...@advisiongraphics.com";
> $send_to[] = "advision_gali...@mac.com";
>
>
> // send email
>
> This is the whole file:
>
>
> <?php
> // Copyright 2004-2007 J.F. Aubertin & AdVision Multimedia
> Productions, all rights reserved.
> //----------------------------------------------------------
> //------------[ Config ]------------------------------------
> //----------------------------------------------------------
>
> $thanks_page = "contact_us_thanks.php";
> $form_page = "contact_us_form.php";
> $mail_page = "contact_us_email.php";
>
> $send_to[] = "davjoh123@yahoo.com";
> $send_to[] = "webmaster@cliffhousecottages.com";
> //$send_to[] = "info@cliffhousecottages.com";
> $email_subject = "Cliffhouse & Treehouse Accommodations - Thank you
> for contacting us!";
> $email_from = "reservaations@cliffhousecottages.com";
>
> $db_table = "clifftree_requests";
>
> //----------------------------------------------------------
> //------------[ Setup ]-------------------------------------
> //----------------------------------------------------------
>
> include_once("fdb_conf.php");
> include_once("flib/txt2htm.php");
>
> if (empty($vars)) $vars=$HTTP_POST_VARS;
> if (empty($vars)) $vars=$HTTP_GET_VARS;
> if (empty($vars)) $vars=$_POST;
>
> //----------------------------------------------------------
> //------------[ Main Code ]---------------------------------
> //----------------------------------------------------------
>
> if (empty($vars))
> {
> include($form_page); exit();
> }
> else
> {
> //if (empty($vars["company"])) $err_msg[] = "Company required.";
> if (empty($vars["firstname"])) $err_msg[] = "First Name Required.";
> if (empty($vars["lastname"])) $err_msg[] = "Last Name Required.";
> if (empty($vars["email"])) $err_msg[] = "Email Required.";
> if (empty($vars["tel_phone"])) $err_msg[] = "Telephone Number
> Required.";
> //if (empty($vars["street"])) $err_msg[] = "Street required.";
> //if (empty($vars["city"])) $err_msg[] = "City required.";
> //if (empty($vars["prov"])) $err_msg[] = "Prov/State
> required.";
> //if (empty($vars["postal"])) $err_msg[] = "Postal Code
> required.";
> //if (empty($vars["country"])) $err_msg[] = "Country required.";
>
> $str="sdate"; if (!checkdate($vars[$str."_month"],$vars[$str."_day"],
> $vars[$str."_year"])) $err_msg[] = "Valid appointment date
> required";
> $str="xdate"; if (!checkdate($vars[$str."_month"],$vars[$str."_day"],
> $vars[$str."_year"])) $err_msg[] = "Valid appointment date
> required";
> $str="ldate"; if (!checkdate($vars[$str."_month"],$vars[$str."_day"],
> $vars[$str."_year"])) $err_msg[] = "Valid appointment date
> required";
>
>
> if (count($err_msg) > 0)
> {
> include($form_page); exit();
> }
> else
> {
> $str="sdate";
> $vars[$str] = sprintf("%04d.%02d.%02d",$vars[$str."_year"],
> $vars[$str."_month"],$vars[$str."_day"]);
> $sdate = mktime(0,0,0,$vars[$str."_month"],$vars[$str."_day"],
> $vars[$str."_year"]);
>
> $str="xdate";
> $vars[$str] = sprintf("%04d.%02d.%02d",$vars[$str."_year"],
> $vars[$str."_month"],$vars[$str."_day"]);
> $xdate = mktime(0,0,0,$vars[$str."_month"],$vars[$str."_day"],
> $vars[$str."_year"]);
>
> $str="ldate";
> $vars[$str] = sprintf("%04d.%02d.%02d",$vars[$str."_year"],
> $vars[$str."_month"],$vars[$str."_day"]);
> $ldate = mktime(0,0,0,$vars[$str."_month"],$vars[$str."_day"],
> $vars[$str."_year"]);
>
> // -- Begin Prepare Insert -------- //
> $ff=array();
> $ff[]="firstname";
> $ff[]="lastname";
> $ff[]="tel_phone";
> $ff[]="email";
>
> $ff[]="accommodation";
> $ff[]="sdate_month";
> $ff[]="sdate_day";
> $ff[]="sdate_year";
> $ff[]="xdate_month";
> $ff[]="xdate_day";
> $ff[]="xdate_year";
> $ff[]="ldate_month";
> $ff[]="ldate_day";
> $ff[]="ldate_year";
> $ff[]="diet_requirements";
>
> $ff[]="comments";
>
> $r = array();
> foreach ($ff as $x)
> $r[$x]=$vars[$x];
> // -- End Prepare Insert ---------- //
>
>
> // add to db, show thanks page
> $r["uid"] = sprintf("%010d",fcounter2($db_type,$db,
> $db_table,"1000000000"));
> $r["adate"] = date("Y.m.d");
> $r["atime"] = date("H.i");
> $r["mdate"] = date("Y.m.d");
> $r["mtime"] = date("H.i");
>
> fdb_insert($db_type,$db,$db_table,$r);
>
>
> // build headers
> $header = sprintf("From: %s\n",$email_from);
>
> if (!empty($mail_page))
> {
> // build headers
> $header .= "MIME-Version: 1.0\n";
> $header .= "Content-Type: text/html\n";
>
> ob_start();
> include($mail_page);
> $message = ob_get_contents();
> ob_end_clean();
> $message .= "\n";
> }
> else
> {
> // build email
> $message = "";
> $message .= sprintf("Subject: %s\n",$subject);
> $message .= "\n";
> $message .= sprintf("Date: %s\n",$r["adate"]);
> $message .= sprintf("Company: %s\n",$r["company"]);
> $message .= sprintf("First Name: %s\n",$r["firstname"]);
> $message .= sprintf("Last Name: %s\n",$r["lastname"]);
> $message .= sprintf("Email: %s\n",$r["email"]);
> $message .= sprintf("Phone: %s\n",$r["tel_phone"]);
> $message .= "\n";
> $message .= sprintf("Mailing: %s\n",$r["mailing"]);
> $message .= "\n";
> $message .= sprintf("Comments:\n",$r["comments"]);
> $message .= sprintf("%s\n",$r["comments"]);
> $message .= "\n";
> }
>
> // send email
> foreach ($send_to as $dest)
> mail($dest,$email_subject,$message,$header);
>
> echo "$dest.\" \".$email_subject.\" \".$message.\" \".$header
> \n"; //test code 09/27/07
>
> mail($r["email"],$email_subject,$message,$header);
>
> include($thanks_page);
> }
> }
>
> //----------------------------------------------------------
> //------------[ Functions ]---------------------------------
> //----------------------------------------------------------
>
> function fcheckbox($name,$value)
> {
> global $vars;
> if ($vars[$name] == $value)
> return " checked";
>
> return "";
> }
>
> //----------------------------------------------------------
> //------------[ End ]---------------------------------------
> //----------------------------------------------------------
>
> ?>
>

OK, a few things. If you have to have the file, instead of using
include_once(), use require_once(). And what are in these files? Do
they perhaps use short tags?

You should use $_POST and $_GET instead of HTTP_POST_VARS and
HTTP_GET_VARS. The former are superglobals, the latter are not.

What's the purpose of this?

ob_start();
include($mail_page);
$message = ob_get_contents();
ob_end_clean();

Including the file will display anything displayable, anyway.

Also, you have a lot of other stuff going on - database, etc.

Is this running on a test sever? If so, you should be running with

display_errors=on
error_reporting=E_ALL

in your php.ini file.

If this is a production server, the above is not a good idea. But you
can do the same thing by putting at the top of your script:

ini_set("display_errors", "1");
ini_set("error_reporting", E_ALL);

If you still can't see anything wrong, strip it down to the bare
minimums and try to get it working. It will be much easier to debug,
and once you get that working, you can add features and ensure it keeps
working.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация