Jump to content


Photo

Having trouble with form sending blank email


  • Please log in to reply
5 replies to this topic

#1 Hades666

Hades666
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 18 September 2006 - 10:08 PM

Hi there, I apologise if this post is not within forum protocol but I am desperate and in need of help!!

I have a contact form that emails the details direct to me and for some reason it has started emailing a blank email now. The only difference is that the server is now running PHP 5.1.4.... I THINK, and bear in mind I am a bit rubbish at all this, that I have got it down to the following code that could be causing the problem. Can anyone help?

function mail_it($content, $subject, $email, $recipient) {
   global $attachment_chunk, $attachment_name, $attachment_type, $attachment_sent, $bcc;

   $ob = "----=_OuterBoundary_000";
   $ib = "----=_InnerBoundery_001";
   
   $headers  = "MIME-Version: 1.0\r\n"; 
   $headers .= "From: ".$email."\n"; 
   $headers .= "To: ".$recipient."\n"; 
   $headers .= "Reply-To: ".$email."\n";
   if ($bcc) $headers .= "Bcc: ".$bcc."\n"; 
   $headers .= "X-Priority: 1\n"; 
   $headers .= "X-Mailer: DT Formmail".VERSION."\n"; 
   $headers .= "Content-Type: multipart/mixed;\n\tboundary=\"".$ob."\"\n";
   
          
   $message  = "This is a multi-part message in MIME format.\n";
   $message .= "\n--".$ob."\n";
   $message .= "Content-Type: multipart/alternative;\n\tboundary=\"".$ib."\"\n\n";
   $message .= "\n--".$ib."\n";
   $message .= "Content-Type: text/plain;\n\tcharset=\"iso-8859-1\"\n";
   $message .= "Content-Transfer-Encoding: quoted-printable\n\n";
   $message .= $content."\n\n";
   $message .= "\n--".$ib."--\n";
   if ($attachment_name && !$attachment_sent) {
      $message .= "\n--".$ob."\n";
      $message .= "Content-Type: $attachment_type;\n\tname=\"".$attachment_name."\"\n";
      $message .= "Content-Transfer-Encoding: base64\n";
      $message .= "Content-Disposition: attachment;\n\tfilename=\"".$attachment_name."\"\n\n";
      $message .= $attachment_chunk;
      $message .= "\n\n";
      $attachment_sent = 1;
   }
   $message .= "\n--".$ob."--\n";
   
   mail($recipient, $subject, $message, $headers);
}

And

// prepare the content
$content = parse_form($HTTP_POST_VARS, $sort);


#2 ronverdonk

ronverdonk
  • Members
  • PipPipPip
  • Advanced Member
  • 277 posts
  • LocationNetherlands

Posted 18 September 2006 - 10:19 PM

Is it possible that your server no longer allows the so called 'register_long_arrays' for PHP5 in the php.ini definitions? When that is turned off the $HTTP_POST_VARS don't work any longer and you'll have to use $_POST instead.

Ronald   8)
RTFM is an almost extinct art form, it should be subsidized.

#3 Hades666

Hades666
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 18 September 2006 - 10:29 PM

Thanks Ronald, I will try that. I knew there was something that needed to be changed about that but I wasn't sure what and I am still learning about all this. I had just managed to get a little bit of knowledge and then it all goes and changes. Darn it.

#4 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 18 September 2006 - 10:45 PM

The upgrade probably also disabled register_globals. Which is the more likely cause for the OPs problem.

Ken

#5 Hades666

Hades666
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 18 September 2006 - 10:51 PM

I changed the code and it worked. Should I be looking to turn these things on instead of changing the code?

#6 ronverdonk

ronverdonk
  • Members
  • PipPipPip
  • Advanced Member
  • 277 posts
  • LocationNetherlands

Posted 18 September 2006 - 11:09 PM

Don't change your ini options to suit your programs in this case. Anyway, $HTTP_POST_VARS is deprecated. So always use $_POST instead.

Ronald   8)
RTFM is an almost extinct art form, it should be subsidized.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users