error message of webmail

This is a discussion on "error message of webmail" within the PHP Forum section. This forum, and the thread "error message of webmail are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old May 27th, 2008, 05:36
Junior Member
Join Date: Nov 2006
Location: us
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
error message of webmail

Can someone please help me to fix the problem that I have at http://www.sandragreen.com/guestbook.php.
Quote:
Your request could not be sent. Sorry!
Based on the guestbook.php code, how can I freely add more fields or remove more fields?
Any inputs will be much appreciate!
http://www.sandragreen.com/Feedback.html
Code: Select all
<html>
<head>
<title>Guest Book</title>
<style>
.title{ font-family:Arial, Helvetica, sans-serif; font-size:larger; font-weight:bold; background-color:#5c8f00; color:fff; padding:20px; margin-left:auto; margin-right:auto; width:50%; border:solid 1px #000000; }
.face{background-color:#e5ebb8; padding:20px ;margin-left:auto; margin-right:auto; width:50%; border-left:solid 1px #ff9900; border-right:solid 1px #ff9900; border-top:solid 2px #cc9933; border-bottom:solid 1px #ff9900; }
.T-face{background-color:#FFFFCC; padding:20px; margin-right:auto; width:50%; border:#FF9900;}
.typer{font-family:Arial, Helvetica, sans-serif; font-size:12px;font-weight:bold; color:#000;}
.data{margin-left:auto; margin-right:auto; }
</style>
</head>
<body>
<div class="title"><h1>Guest Book</h1></div>
<form action="guestbook.php" method="POST" enctype="multipart/form-data" class="face">
<div class="data"><span class="typer">To:</span> <input type="text" name="to" value="" /><br />
<span class="typer">From:</span> <input type="text" name="from" value="" /><br />
<span class="typer">Subject:</span> <input type="text" name="subject" value="" /></div>
<div class="data">
<span class="typer">Name:</span>
<input type="text" name="name" value=""><br />
<span class="typer">Telephone:</span><input type="text" name="telephone" value=""><br />
<span class="typer">Address:</span><input type="text" name="address" value=""><br />
</div>
<div class="data"><span class="typer">Message:</span><br />
<textarea cols="50" rows="20" name="message"></textarea></div>
 
<div class="data"><span class="typer">File Attachment:</span><input type="file" name="fileatt" /></div>
<div class="data"><input type="submit" value="Send" /></div>
</form>
</body>
</html>
http://www.sandragreen.com/guestbook.php
Code: Select all
<?php
// Read POST request params into global vars
$to      = $_POST['to'];
$from    = $_POST['from'];
$subject = $_POST['subject'];
$name = $_POST['name'];
$telephone = $_POST['telephone'];
$address = $_POST['address'];
$message = $_POST['message'];
// Obtain file upload vars
$fileatt      = $_FILES['fileatt']['tmp_name'];
$fileatt_type = $_FILES['fileatt']['type'];
$fileatt_name = $_FILES['fileatt']['name'];
$headers = "From: $from";
if (is_uploaded_file($fileatt)) {
  // Read the file to be attached ('rb' = read binary)
  $file = fopen($fileatt,'rb');
  $data = fread($file,filesize($fileatt));
  fclose($file);
  // Generate a boundary string
  $semi_rand = md5(time());
  $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
 
  // Add the headers for a file attachment
  $headers .= "\nMIME-Version: 1.0\n" .
              "Content-Type: multipart/mixed;\n" .
              " boundary=\"{$mime_boundary}\"";
  // Add a multipart boundary above the plain message
  $message = "This is a multi-part message in MIME format.\n\n" .
             "--{$mime_boundary}\n" .
             "Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
             "Content-Transfer-Encoding: 7bit\n\n" .
             $message . "\n\n";
  // Base64 encode the file data
  $data = chunk_split(base64_encode($data));
  // Add file attachment to the message
  $message .= "--{$mime_boundary}\n" .
              "Content-Type: {$fileatt_type};\n" .
              " name=\"{$fileatt_name}\"\n" .
              //"Content-Disposition: attachment;\n" .
              //" filename=\"{$fileatt_name}\"\n" .
              "Content-Transfer-Encoding: base64\n\n" .
              $data . "\n\n" .
              "--{$mime_boundary}--\n";
}
// Send the message
$ok = @mail($to, $subject, $name, $telephone, $address, $message, $headers);
if ($ok) {
  echo "<p>Thank you for sending your comments, we'll contact you soon!</p>";
} else {
  echo "<p>Your request could not be sent. Sorry!</p>";
}
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old May 27th, 2008, 12:47
CloudedVision's Avatar
Moderator
Join Date: Feb 2008
Location: In My Own Little World
Age: 14
Posts: 1,255
Blog Entries: 9
Thanks: 2
Thanked 40 Times in 40 Posts
Re: error message of webmail

For the first one, it looks like your mail() function isn't working properly. Contact your host about that.
__________________
Web Design And Development: Other Road Design | Problems with IE6?: KApp | My Blog: Only Nerds Allowed | Learning PHP? Lessons
Last Blog Entry: Hilarious Rapper (Jul 29th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old May 27th, 2008, 19:39
Junior Member
Join Date: Nov 2006
Location: us
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Re: error message of webmail

Much appreciate it!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Keep getting error message Microsoft VBScript runtime error '800a01a8' cpando1974 Classic ASP 2 Aug 7th, 2007 12:00
Please Help Fix This Error Message DannyP43 JavaScript Forum 3 Sep 26th, 2006 22:04
Why error message in status bar? Sofie PHP Forum 11 May 13th, 2006 18:23
Another ASP script error message a.jenery Classic ASP 13 Apr 21st, 2006 01:10
Error Message: TextBox accessman Databases 1 Oct 15th, 2005 01:07


All times are GMT. The time now is 15:41.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42