Menu

Content Missing From Email

Help
Rich
2007-05-02
2013-06-03
  • Rich

    Rich - 2007-05-02

    I've looked through the forumsd and found a couple threads similiar to my problem but not exactly.

    Problem:  Four days ago all emails generated by my forms (from 12 websites all hosted with mewebhost) started showing up without any content in the body area. At first I thought it was because of some slight code changes I made to the forms to stop spammers so I removed the code and reloaded the process.php file but the email still shows up without any data in the body.

    I've even gone so far as to delete the entire form generator and all of my forms and rebuild them, still no luck.  So this led me to beleive that perhaps it was not something I had done but something the hosting service had done.

    Four days ago when I used my WS_FTP program, it would log on and then boot me off within a second. I called my hosting service, they did something and then my FTP worked but then my problem with the forms started. 

    After four days, a hundred emails and several frustrating phone calls, I'm no closer to a solution than four days ago.

    I found a couple things that may be the problem but I don't understand them enough to explain them so I'm hoping someone here can help.

    Here is one post I found on this site, "...the other possibility is that you misplaced the register globals function file, and hence the variables from the form fields are not being registered." This sounds like what's happening to me but where do I find the
    globals function file" and what do I do with it?

    The other post I found said, "...perhaps your hosting service turned off the "Check PHP Errors", would this have anything to do with my problem?

    Is there something that a hosting service can turn on or off that affects the forms ability to send data?  It just seems wierd that I get the email but not the data?

    Additional Information:
    I've ruled out the problem being with my ISP or my own computer settings, as we've tested all systems and email comes through just fine as lond as it's not generated by a form submission. 

    Any help is greatly appreciated.

    Rich
      

     
    • TNTEverett

      TNTEverett - 2007-05-02

      As a test replace the process.php file with a copy modified the following way.
      First make a backup copy then do the following.

      For example:
      Find the last line that starts with pt_register
      <?php
      include("global.inc.php");
      $errors=0;
      $error="The following errors occurred while processing your form input.<ul>";
      pt_register('POST','Broker');
      pt_register('POST','ContactPhone');
      pt_register('POST','Email');

      Remove everything below that last line then add the following.  For each pt_register variable add an echo using the variable name.  Add the php termaination at the end.

      echo "<br>Broker:  $Broker<br>";
      echo "Contact Phone:  $ContactPhone<br>";
      echo "Email:  $Email<br>";
      ?>

      What this should do is just print the variables in a new browser window.  If the values returned are blank then you have a basic problem getting the values from the form1.html file into the process.php file.  If the values from your form are returned properly then at least you are getting data from the form.  That is half the battle. 
      Start with that and let me know what you get. 

       
    • Rich

      Rich - 2007-05-02

      First, thanks for such a fast response. I did what you asked and the data showed up in the browser just fine...

      First Name: Richard
      Last Name: Rafferty
      Email: r_raffman@bellsouth.net

      Any suggestions on where to go from here? 

       
      • TNTEverett

        TNTEverett - 2007-05-02

        The next step is to put back the section that formats the email message and displays the message that would be sent. 

        $message = "<br>Broker: $Broker<br>
        Contact Phone: $ContactPhone<br>
        Email: $Email<br>";

        Include the first $message = and any other $message .= line.  Put these lines right above the php termination of the file you previously created.
        Add another line just before the php termination like this.

        echo "Message: $message<br>";

        Let me know if the email message data is displayed below your last test data. 

         
        • Rich

          Rich - 2007-05-02

          Okay, It displays the message like this...
          First Name: Bill
          Last Name: Johnson
          Email: Rich@hotmal.com
          Message: fname: Bill lname: Johnson Email: Rich@hotmal.com

          Which I assume is correct?

           
    • Rich

      Rich - 2007-05-03

      TNTEverett
      I hope I have not upset you somehow?  Earlier today you assisted me in this post by helping me narrow down what might be the problem with the content from my forms not showing up.

      The last thing I did was add the...

      $message = "<br>Broker: $Broker<br> 
      Contact Phone: $ContactPhone<br> 
      Email: $Email<br>"; 

      echo "Message: $message<br>"; 

      This displayed the content in the browser.  I not not sure where to go from here, if you can please advise me...

      Thank you Rich

       
      • TNTEverett

        TNTEverett - 2007-05-03

        Sorry, I had some other things to take care of yesterday.  I do the best I can but if I disappear for a short time, I will eventually get back to the forum. 
        So it looks like you are getting all the right data from your form, and the message preparation is proceeding correctly.  Next step is to add the mail function. 

        Again down at the bottom of the process.php file just before the php termination add the following line.

        mail("youremail@yoururl.com","Form Submitted at your website",$message,"From: phpFormGenerator");

        Let me know if you get the email and if it includes the same message displayed in the browser as the previous test. 

         
    • Rich

      Rich - 2007-05-04

      First, thanks for coming back!  I've been trying stuff all day with no luck!  I just added the mail information and it came through like it's supposed to.

      So now I'm confused because the leads me to believe the code is somehow wrong on all of my process forms? 

      The only thing I can think of is I had to re-download the phpformgenerator last week, and because the version "c" would not open, I kept getting the error 'Error Reading Header after processing zero entries" so I downloaded the phpFormGen-php-2.09b.tar.gz and used it to rebuild my forms.

      Do you think this is part of the problem? 

      How do I fix this?

      Thank you so much for your help.

      Rich

       
      • TNTEverett

        TNTEverett - 2007-05-04

        I'm not sure what the problem is.  It does look like all the pieces work.  Send me an email with one of your process.php files and a pointer to that form1.html file. 
        I can install this on my local PC and test it as you designed it. 

         
      • TNTEverett

        TNTEverett - 2007-05-04

        OK, so the process.php file you sent and the copy of the form1.html I used work just fine.  What do you get when you attempt to use this form?

         
    • Rich

      Rich - 2007-05-04

      The content does not show up in the email.  I get the email with just the headers (TO: From: Subject:) but no content.

       
    • Rich

      Rich - 2007-05-04

      I've been experimenting using the code you posted here and I've been able to get a form to work with this code...

      <?php
      include("global.inc.php");
      $errors=0;
      $error="The following errors occurred while processing your form input.<ul>";
      pt_register('POST','fname');
      pt_register('POST','lname');
      pt_register('POST','Email');
      pt_register('POST','LetterName');

      $message = "First Name: $fname<br> 
      Last Name: $lname<br> 
      Email: $Email<br>
      LetterName: $LetterName";

      $message = stripslashes($message);
      mail("r_raffman@bellsouth.net","amend-debt-payment-agreement",$message,"From: Home Computer");

      ?>

      However, when I try to add this code...

      if($Email=="" ){
      $errors=1;
      $error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
      }
      if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
      $error.="<li>Invalid email address entered";
      $errors=1;
      }
      if($errors==1) echo $error;
      else{
      $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));

      $message = "First Name: $fname<br> 
      Last Name: $lname<br> 
      Email: $Email<br>
      LetterName: $LetterName";

      $message = stripslashes($message);

      I get a parsing error...

       
      • TNTEverett

        TNTEverett - 2007-05-04

        What is the parsing error?  Can you send me the message?
        Got your next post.
        Adding the html is not the issue.  It looks like you've added other php termination code.  This may have something to do with it but I'm not sure.  I would have to see all your code.  In any case this should all be part of the form generation.  If you make no modifications the gerated form should work. 
        Where do you want to go from here if the form is now working?

         
    • Rich

      Rich - 2007-05-04

      Okay, I just used this code and it worked...(see below for the only change I made)

      <?php
      include("global.inc.php");
      $errors=0;
      $error="The following errors occurred while processing your form input.<ul>";
      pt_register('POST','fname');
      pt_register('POST','lname');
      pt_register('POST','Email');
      pt_register('POST','LetterName');

      $message = "First Name: $fname<br> 
      Last Name: $lname<br> 
      Email: $Email<br>
      LetterName: $LetterName";

      if($Email=="" ){
      $errors=1;
      $error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
      }
      if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
      $error.="<li>Invalid email address entered";
      $errors=1;
      }
      if($errors==1) echo $error;
      else{
      $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));

      $message = stripslashes($message);
      mail("r_raffman@bellsouth.net","amend-debt-payment-agreement",$message,"From: Home Computer");

      ?>

      <HTML>
        <HEAD>
           <TITLE>Letter and Form Request Submission Success</TITLE><LINK
           REL="stylesheet" HREF="../../../debtletters.css" TYPE="text/css">
        </HEAD>
        <BODY LEFTMARGIN="0" TOPMARGIN="0">
           <H1 ID="first">Debt-n-Credit Letters.<FONT
              COLOR="#FF0000">com</FONT></H1><HR SIZE="4" COLOR="#FF0000">
           <TABLE WIDTH="100%" BGCOLOR="#FFFFFF" CELLPADDING="15" CELLSPACING="0"
            BORDERCOLOR="#000000">
              <TR>
                <TD WIDTH="80%" BGCOLOR="#FFFFFF">
                   <H3><BR><BR>Congratulations!<BR>You've successfully submitted the
                      following request...</H3>
                   <TABLE WIDTH="70%" CELLPADDING="5" CELLSPACING="0">
                      <TR VALIGN="TOP">
                        <TD VALIGN="TOP" ALIGN="RIGHT" WIDTH="30%">
                           <P><STRONG>First Name: </STRONG></P></TD>
                        <TD WIDTH="70%" VALIGN="TOP" ALIGN="LEFT">
                           <P><?PHP echo $fname; ?></P></TD>
                      </TR>
                      <TR>
                        <TD VALIGN="TOP" ALIGN="RIGHT" WIDTH="30%">
                           <P><STRONG>Last Name: </STRONG></P></TD>
                        <TD WIDTH="70%" VALIGN="TOP" ALIGN="LEFT">
                           <P><?PHP echo $lname; ?></P></TD>
                      </TR>
                      <TR>
                        <TD VALIGN="TOP" ALIGN="RIGHT" WIDTH="30%">
                           <P><STRONG>Your Email: </STRONG></P></TD>
                        <TD WIDTH="70%" VALIGN="TOP" ALIGN="LEFT">
                           <P><?PHP echo $Email; ?></P> </TD>
                      </TR>
                      <TR>
                        <TD VALIGN="TOP" ALIGN="RIGHT" WIDTH="30%">
                           <P><STRONG>Name of Document:</STRONG> </P></TD>
                        <TD WIDTH="70%" VALIGN="BOTTOM" ALIGN="LEFT">
                           <P><?PHP echo $LetterName; ?></P></TD>
                      </TR>
                   </TABLE>
                   <BLOCKQUOTE>
                      <P><B>IMPORTANT MESSAGE: </B>Please keep in mind that some email
                        servers can be slow at times, especially during peak hours. After receiving
                        your request I immediately forward the requested document however, depending on
                        your email server's speed, it may take just a few minutes or as long as several
                        hours before the document arrives in your E-mail in-box. </P>
                      <P ALIGN="LEFT">Common reasons why you may not receive the
                        document:</P>
                      <BLOCKQUOTE>
                        <OL>
                           <LI>You're spam filters ate it; (please look in your spam
                              folder) </LI>
                           <LI>You're Email address is wrong; </LI>
                           <LI>You're Inbox is full or reached it's size limit;</LI>
                           <LI>You're server is slow or down for maintenance</LI>
                           <LI>You require Email verification before accepting email (my
                              system is automated so unless you turn this feature off you will not receive
                              the requested document).</LI>
                        </OL></BLOCKQUOTE></BLOCKQUOTE>
                   <H2>Return to: <A
                      HREF="http://www.debt-n-credit-letters.com/">Homepage</A> or choose a new site
                      from the list below...</H2>
                   <TABLE WIDTH="100%" CELLPADDING="10" CELLSPACING="0">
                      <TR VALIGN="TOP">
                        <TD VALIGN="TOP" ALIGN="LEFT" WIDTH="50%">
                           <P><SPAN CLASS="sm"><A
                              HREF="http://www.personal-finance-loans.com/">Personal Loans</A><BR><A
                              HREF="http://www.debt-n-loan-consolidation.com/">Debt and Loan
                              Consolidation</A><BR><A HREF="http://www.stopping-banks-foreclosures.com/">How
                              to Stop Bank Foreclosures</A> <BR><A
                              HREF="http://www.hobby-shop-center.com/">Find 1000s of Toys and
                              Hobbies</A><BR><A HREF="http://www.chapter-7-bankruptcy-forms.com/">How to File
                              Chapter 7 Bankruptcy</A><BR><A HREF="http://www.chapter-13-bankruptcy.com/">How
                              to File Chapter 13 Bankruptcy</A></SPAN></P></TD>
                        <TD WIDTH="50%" VALIGN="TOP" ALIGN="LEFT">
                           <P><SPAN CLASS="sm"><A
                              HREF="http://www.small-claims-courts.com/">How to File In Small Claims
                              Courts</A><BR><A HREF="http://www.debt-n-credit-letters.com/">Free Sample Debt
                              and Credit Letters</A><BR><A HREF="http://www.fair-credit-reporting.com/">How
                              to Achieve Fair Credit Reporting</A><BR><A
                              HREF="http://www.child-support-collections.com">How to Collect Past Due Child
                              Support</A><BR><A HREF="http://www.student-loan-default.com/">How to Handle
                              Student Loans in Default</A><BR><A
                              HREF="http://filing-bankruptcy-form.com/">How to File Bankruptcy with Free
                              Forms</A><BR><A HREF="http://www.fair-debt-collection.com/">How to Deal with
                              Debt Collection Issues</A></SPAN></P></TD>
                      </TR>
                   </TABLE><HR SIZE="4" COLOR="#FF0000">
                   <P ALIGN="CENTER"> <SPAN CLASS="small">Rich's Enterprises, L.L.C.,
                      Prattville, Alabama<BR><A HREF="../../../Legal-Disclaimer.html">Legal
                      Disclaimer</A> | <A HREF="../../../sitemap-1.html">Sitemap</A> </SPAN> </P>
                   <P ALIGN="LEFT"> <SPAN CLASS="nav"><A
                      HREF="../../../index.html">Debt-n-Credit Home</A> &gt;&gt; Letter and Form
                      Request Submission Success</SPAN> </P> </TD>
              </TR>
           </TABLE> </BODY>
      </HTML>

      ?><?php
      }
      ?>

      I added the "html code" and then added this:
      ?><?php
      }
      ?>

      which prevented the parsing error, submitted the form and the content showed up.

      Looking at all of the code, I'm still lost on what I did wrong??

       
    • Rich

      Rich - 2007-05-04

      Well, I have a couple questions if you don't mind?

      1. I just generated a new form using phpformgen version phpFormGen-php-2.09b.tar.gz
      (I can't get the downloaded version "c" to open) and it does not work, so this leads me to beleive the program is not working correctly?  

      I have saved the form and code you helped me with as a master template and can rebuild all of the process.php files I need (about 100) so I thank you for that, but if there was a way tio get the phpformgen to work that would save me a great deal of time.

      Any suggestions?

      2. What started me down this road is I was trying to add a little security to my forms so I added the following two pieces of code (found elsewhere is this forum).

      First snippet...

      <?php
      include("global.inc.php");
      if (preg_match("/AddURL/", $_SERVER['HTTP_REFERER'])) {

      else { 
      echo "Warning! You have accessed this form without permission. All accesses to this form are recorded. Improper use will be traced and proper legal action will be taken.";
      exit; 

      ...of course I added the correct /addURL/ and the form worked

      then I added this code...
      $find = array("/bcc\:/i","/Content\-Type\:/i","/cc\:/i","/to\:/i");

      which I thought was to supposed to prevent people from using my from to spam others by preventing them from sending it to BC or CC.

      At some point, after adding the above code, the content stopped showing up so I went back and removed the code but it did not change.  That's when I redownloaded the phpformgen and started rebuiding the forms but even that did not change the content issue.

      I said all that to ask this...is the two snippets worth using?  If so, how do I use them correctly?

      Thanks for so much help, I'm sure you have a hundred other things you could be doing. :)

       
      • TNTEverett

        TNTEverett - 2007-05-04

        1.) 2.09b is the version I use.  I have no problems using the generator now.  After a few installation glitches I have used the generator for quite some time now.  Other things I have done are;
        Installed UniformServer on my PC in order to use phpFormgenerator and test forms before loading them to my server.  I also use HAPedit to edit and debug php code. 
        http://www.uniformserver.com/
        http://hapedit.free.fr/
        Both are Free.

        You should be able to unzip phpFormgenerator on your local PC and then just copy the code to your host and it should work.  Only some file permissions may have to change.  There is no one set of instructions that will allow everyone to install the SW on any host.  Since each host is different, some users will have no problems, some will have many problems. 

        I think it is worth while for you to solve the installation issues so that you can successfully use the generator.  Let me know if you need more help with that.  Note that you may have to setup a temporary username and password so that I have access to your host account. 

        2.) The first one is good.  I use something very similar.  The second one is only relevant if you allow people to enter email addresses that are used to send email to users other than the one you specifiy in the mail() function.  In the process.php code you sent you have this line;
        mail("youremailaddress","Myth Busters Request",$message,"From: Fair Debt Collection");
        Spammers usually take advantage when the email address portion is open for user entry.  You can then hack the way the mail function sees the data.  Using commas and other codes in the email address field the mail function will see all relevant fields to send whatever email they define and the rest that you specify in your code is ignored. 

        The first field is the email address to which the message will be sent.
        The second field is th esubject of the message.
        The third field is th emessage body.
        The last field is the header.

        All of these fields are fixed by you.  The BC and CC fields are part of an email header.  Since this field is fixed by you, your form users can not modify the header and therefore can not use your form to spam others.  I can not say that is is not possible with 100% confidence because I don't know if it is possible to hack the mail() function.  I can say that it is highly unlikely that using the mail() function in this way will allow anyone to use your form to spam others. 

         
    • Rich

      Rich - 2007-05-04

      Wow! Great information! I'll download those programs you mentioned.  I also have used phpformgen for a few years and until now never had a problem.

      I did just discover something interesting.  I reinstalled phpformgen version "b" and then built a form. I submitted the form and got the same result, no content. So I compared the process file to the master file we built together and here's the difference:

      a portion of the code just produced..
      $message="fname: ".$fname."
      lname: ".$lname."
      state: ".$state."
      Email: ".$Email."
      contactphone: ".$contactphone."
      besttimetocall: ".$besttimetocall."
      comments: ".$comments."
      terms: ".$terms."
      consumerstatement: ".$consumerstatement."
      CreditRepairLead: ".$CreditRepairLead."
      ";

      and here is the code from the masterprocess.php

      $message = "First Name: $fname
      Last Name: $lname
      State: $state
      Email: $Email
      Contact Phone: $contactphone
      Best Time to Call: $besttimetocall
      Comments: $comments
      Terms: $terms
      Consumer Statement: $consumerstatement
      CreditRepairLead: $CreditRepairLead";

      When I removed all of the ", and . (from this: lname: ".$lname." to this: lname: $lname)

      The code worked great, all content showed up! 

      So I guess I need to download the latest version of phpformgen because it appears the one I'm using has a glitch in it. Is there an alternate location to download the file?

       
      • TNTEverett

        TNTEverett - 2007-05-04

        The following code works in one of my forms.  So I don't think this is your problem unless your host or your email is somehow filtering this out. 
        The ".$variable." syntax is perfectly acceptable in php when separating variables from text. 

        $message="First Name: ".$FirstName."
        Last Name: ".$LastName."
        Email: ".$Email."
        Confirm Email: ".$ConfirmEmail."
        Maiden Name: ".$MaidenName."
        City: ".$City."
        State: ".$State."
        Zip: ".$Zip."
        Have you ever paid off a mortgage If so please enter year: ".$HaveyoueverpaidoffamortgageIfsopleaseenteryear."
        WOULD YOU LIKE A NATION WIDE SEARCH Please enter other states you have lived in: ".$WOULDYOULIKEANATIONWIDESEARCHPleaseenterotherstatesyouhavelivedin."
        City 1: ".$City1."
        State 1: ".$State1."
        City 2: ".$City2."
        State 2: ".$State2."
        City 3: ".$City3."
        State 3: ".$State3."
        ";

        Here is a link to all available versions of phpFormgenerator.
        https://sourceforge.net/project/showfiles.php?group_id=45605

         
    • Rich

      Rich - 2007-05-04

      I downloaded the latest version, installed it, set the permissions and built a form...same result; no content! 

      The only way I've been able to get content to show up is to use the master form we built, and keep coppying it and testing it.  Funny thing is on two sites (with same exact hosting service), the master script does not work. I'm working down through all of my forms now, (I need to get as many as I can working, I've already lost 6 days of business) and then I'll wortk with the sites I can't get to work and come back here and post my progress...very slow at this point.

      Are there PHP settings my hosting service can set, turn on/off?  I ask because I wonder if they did so without realizing it.  They continue to tell me the problme is my email address but now we know that is simply not true.

      Will be back soon, need to work about 60 forms...

       
      • TNTEverett

        TNTEverett - 2007-05-04

        My host did something a while back that rendered my forms unusable but it was permissions or something like that.  Once it was corrected the forms worked OK so the issue does not appear to similar to yours. 
        We can customise the generator to produce something that works for you but you will still have to regenerate your forms or simply edit them like you are doing now. 
        Let me know if you want to try this modification. 

         
    • Rich

      Rich - 2007-05-05

      Wow!  What a long long night!  I rebuilt over 100 forms.  Copy and paste does not work because for some reason, what works on one domain will not work on another? 

      I ended up changing line by line to figure out why the content was not showing up.
      It drove me nuts because I had to make minor changes like the following (all for the same host but different domains):

      This...
      City: ".$City."
      State: ".$State."
      Zip: ".$Zip."
      ";

      or this...
      City: ".$City."
      State: ".$State."
      Zip: ".$Zip." ";

      or this...
      City: $City
      State: $State
      Zip: $Zip
      ";

      or this...
      City: $City
      State: $State
      Zip: $Zip ";

      These are just a few examples!  So, I'm not sure if it's even possible to set up  phpformgen to work across the board?

      Right now I plan to download the programs you mentioned above and then fix my other 200 forms. If you have time, perhaps we can try to install it on one of my larger domains and see what happens.  I'm monitoring this thread so I'll check back.

       
      • TNTEverett

        TNTEverett - 2007-05-06

        Sounds like there is some basic PHP configuration change causing the issue.  This is just too wierd to be anything else. 

         
    • TNTEverett

      TNTEverett - 2007-05-06

      Try something like this on the message variable right before the mail function to see if it makes a difference.
      $message=preg_replace("/(\015\012)|(\015)|(\012)/","", $message);

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.