Can anybody tell me why this code is not working.
When I hit submit I get the error and it would not send the email.
[php]
//
<table width="1004" border="0" cellspacing="0"
cellpadding=“0”> |
<table width=“100%” border=“0”
cellspacing=“0” cellpadding=“0”> |
<img src=“images/tonerplus_09.jpg” width=“22” height=“215”
/> |
<img src=“images/tonerplus_13.jpg” width=“22” height=“36”
/> |
cellspacing=“0” cellpadding=“0”>
src=“images/tonerplus_03.jpg” width=“13” height=“29” />
?>
src=“images/tonerplus_12.jpg” width=“752” height=“215” />
cellpadding=“0”>
height=“36” />
<td rowspan=“2” valign=“top” bgcolor="#375996"
class=“bordertopwithbannerbelowimage”><table width=“100%” border=“0”
cellspacing=“0” cellpadding=“0”>
<tr>
<td height="40" colspan="2" align="left"
valign=“middle”><img src=“images/selltous-title.jpg” width=“98” height=“25”
/>
<td width=“74%” align=“left” valign=“bottom”
class=“welcome-desc”>
We are ready to pay for your surplus copier, printer
and fax supplies.
Tonerplussurplus.com is willing to pay
for all your overstocked, unwanted, and duplicating supplies. Please take an
inventory of your available stock and fill out the form below for an
immediate quote. Also note that we pay for shipping.
height=“36” />
height=“178” />
cellpadding=“0”>
src=“images/tonerplus_24.jpg” width=“13” height=“22” />
width=“456” height=“22” />
src=“images/tonerplus_28b.jpg” width=“25” height=“22” />
<?
if(isset($send_mail))
{
ob_start();
?>
<table width="100%" border="0" cellspacing="0"
cellpadding=“0” style=“font-family:Arial; font-size:12px; color:#375996;”>
cellspacing=“7” cellpadding=“0” style=“font-family:Arial; font-size:12px”>
<?
if(isset($_POST[“textfield”]))
{
?>
<td colspan=“2” align=“right”
valign=“middle” style="text-align:center; font-family:Arial, Helvetica,
sans-serif; font-weight:bold; font-size:12px; color:#375996;">Information
Sent
<td width=“40%” align=“right” valign=“middle”
style="font-family:Arial, Helvetica, sans-serif; font-weight:bold;
font-size:12px; color:#375996;">Contact Name:
<?
}
?>
<?
if(isset($_POST[“textfield2”]))
{
?>
<td align=“right” valign=“middle”
style="font-family:Arial, Helvetica, sans-serif; font-weight:bold;
font-size:12px; color:#375996;">Company:
<?
}
?>
<?
if(isset($_POST[“textfield3”]))
{
?>
<td align=“right” valign=“middle”
style="font-family:Arial, Helvetica, sans-serif; font-weight:bold;
font-size:12px; color:#375996;">Country Code:
</td>
</tr>
<?
}
?>
<tr>
<td align="right" valign="middle"
style="font-family:Arial, Helvetica, sans-serif; font-weight:bold;
font-size:12px; color:#375996;">Tel:
<td align=“right” valign=“middle”
style="font-family:Arial, Helvetica, sans-serif; font-weight:bold;
font-size:12px; color:#375996;">Fax:
<td align=“right” valign=“middle”
style="font-family:Arial, Helvetica, sans-serif; font-weight:bold;
font-size:12px; color:#375996;">E-mail:
<?
if(isset($_POST[‘reorder’]) && count($_POST[‘reorder’]) > 0 && $_POST[‘reorder’][0]!=’’)
{
?>
<tr>
<td colspan="2"><table id="tblid" width="100%" border="0"
cellspacing=“6” cellpadding=“0” style=“font-family:Arial; font-size:12px”>
<td align=“center” style="font-family:Arial, Helvetica,
sans-serif; font-weight:bold; font-size:12px; color:#375996;">Quantity
<td align=“center” style="font-family:Arial, Helvetica,
sans-serif; font-weight:bold; font-size:12px; color:#375996;">Brand
<td align=“center” style="font-family:Arial, Helvetica,
sans-serif; font-weight:bold; font-size:12px; color:#375996;">Re-Order #
<?
for($counter=0;$counter<count($reorder);$counter++)
{
if(strlen(trim($reorder["$counter"]))>0)
{
?>
<?
}
}
?>
<tr>
<td height="40" colspan="2" align="left"
valign=“middle”>
<td height=“20” colspan=“2” align=“left” valign=“middle”
style="font-family:Arial, Helvetica, sans-serif; font-weight:bold;
font-size:12px; color:#375996;"> Message
<td height=“40” colspan=“2” align=“left”
valign=“middle”>
<?=$_POST["textarea"]?>
<tr>
<td height="40" colspan="2" align="left"
valign=“middle”>
<?
}
?>
<?
$extra_message=ob_get_contents();
ob_end_clean();
ob_clean();
ob_flush();
////////////////////////////////////////
$toname = "Rudra";
$emailaddress = "[email protected]";
// $fromaddress = "[email protected]";
$fromaddress = $_POST[‘textfield6’];
$emailsubject=“Contact Information”;
$eol="rn";
$mime_boundary=md5(time());
$name = $_POST[‘textfield’];
// To send HTML mail, the Content-type header must be set
$headers = ‘MIME-Version: 1.0’ . “rn”;
$headers .= ‘Content-type: text/html; charset=iso-8859-1’ . “rn”;
// Additional headers
$headers .= 'To: '.$toname.'<'.$emailaddress.'>' . "rn";
$headers .= 'From: '.$name.'<'.$fromaddress.'>' . "rn";
/*
Common Headers
$headers .= ‘From: ‘.$name.’<’.$fromaddress.’>’.$eol;
$headers .= ‘Reply-To: ‘.$name.’<’.$fromaddress.’>’.$eol;
$headers .= ‘Return-Path: ‘.$name.’<’.$fromaddress.’>’.$eol; // these two to set reply address
$headers .= “Message-ID: <”.$now." TheSystem@".$_SERVER[‘SERVER_NAME’].">".$eol;
$headers .= “X-Mailer: PHP v”.phpversion().$eol; // These two to help avoid spam-filters
Boundry for marking the split & Multitype Headers
$headers .= ‘MIME-Version: 1.0’.$eol;
$headers .= “Content-Type: multipart/related; boundary=”". $mime_boundary.""".$eol;
*/
$emsg = $extra_message;
$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: text/html; charset=iso-8859-1".$eol;
$msg .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
$msg .= $emsg.$eol.$eol;
$msg .= "--".$mime_boundary."--".$eol.$eol; // finish with two eol's for better security. see Injection.
if(isset($_FILES['filename']))
$filename = $_FILES['filename']['name'];
//echo 'filename = '.$filename;
if(isset($filename)&&(strlen(trim($filename))>0))
{
if($_FILES['filename']['type']=="text/richtext" || $_FILES['filename']['type']=="application/msword" || $_FILES['filename']['type']=="application/pdf"){
$extension=explode(".",$_FILES['filename']['name']);
copy($_FILES['filename']['tmp_name'],"attachments/attachment.".$extension[1]);
$resource="attachment.".$extension[1];
//$attachment = fread(fopen("attachments/".$resource, "rb"), filesize("attachments/".$resource));
$handle=fopen("attachments/".$resource, 'rb');
$f_contents=fread($handle, filesize("attachments/".$resource));
$f_contents=chunk_split(base64_encode($f_contents)); //Encode The Data For Transition using base64_encode();
fclose($handle);
// $file_name = substr("attachments/".$resource, (strrpos($attachments[$i]["file"], "/")+1));
$file_name = "attachments/".$resource;
// echo "(((".$attachment["content_type"];
# Attachment
$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: ".$_FILES['filename']['type']."; name="".$file_name.""".$eol;
$msg .= "Content-Transfer-Encoding: base64".$eol;
$msg .= "Content-Disposition: attachment; filename="".$file_name.""".$eol.$eol; // !! This line needs TWO end of lines !! IMPORTANT !!
$msg .= $f_contents.$eol.$eol;
HTML Version
Finished
//$msg .= "--".$mime_boundary."--".$eol.$eol; // finish with two eol's for better security. see Injection.
SEND THE EMAIL
/*echo $emailaddress.'<br>';
echo $emailsubject.'<br>';
echo $msg.'<br>';
echo $headers.'<br>';*/
}else{
echo '<script language="javascript">alert('Recommended file type are .doc and .pdf'); history.back();</script>';
}
}
//$mailSent = mail($emailaddress, $emailsubject, $msg, $headers);
$mailSent = @mail($emailaddress, $emailsubject, $msg, $headers);
if(file_exists($file_name))
unlink($file_name);
//echo $msg;
///////////////////////////////////////
if($mailSent){
$msgs = "Your email has been Sent";
}else{
$msgs = "Error!! email could not be sent";
}
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="center"><strong><?php echo $msgs; ?></strong></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<?
}
else
{
?><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="13" valign="top" bgcolor="#E2E5EE"><img
src=“images/tonerplus_28c.jpg” width=“13” height=“211” />
<td height=“500” colspan=“2” valign=“top” bgcolor="#E2E5EE"
class=“bordertop”><table width=“100%” border=“0” cellspacing=“0”
cellpadding=“0”>
src=“images/surplus-buyer-form-title.jpg” width=“189” height=“24” />
<table width=“100%” border=“0” cellspacing=“0”
cellpadding=“0”>
cellspacing=“7” cellpadding=“0”>
<td width=“40%” align=“right” valign=“middle”
class=“textfields-title”>Contact Name:
type=“text” class=“textfields” />
<td align=“right” valign=“middle”
class=“textfields-title”>Company:
type=“text” class=“textfields” />
<td align=“right” valign=“middle”
class=“textfields-title”>Country Code:
type=“text” class=“textfields” />
(If you are
outside of US)
<td align=“right” valign=“middle”
class=“textfields-title”>Tel:
type=“text” class=“textfields” />
<td align=“right” valign=“middle”
class=“textfields-title”>Fax:
type=“text” class=“textfields” />
<td align=“right” valign=“middle”
class=“textfields-title”>E-mail:
type=“text” class=“textfields” />
border=“0” cellspacing=“0” cellpadding=“0”>
<td colspan=“2” valign=“middle”
class=“textfields-title”>
If you would like to mail or fax us a list of
your inventory, you can download and print it out.
href=“images/tonerplussurplus.pdf” target="_blank"
class=“linkbuttons”>Download the Form
href=“images/tonerplussurplus.pdf” target="_blank"><img
src=“images/pdf-img.gif” width=“32” height=“31” border=“0” />
<td height=“65” colspan=“2” align=“center”
valign=“middle” class=“textfields-title”> If you have your inventory on file,
upload here or fill out the form below.
<input name=“filename” type=“file”
class=“textfields” />
<div
class=“textfields-comments” style=“padding-right:30px”>(Recommended file
formats are doc,pdf)
border=“0” cellspacing=“6” cellpadding=“0”>
<td align=“center”
class=“textfields-title”>Quantity
<td align=“center”
class=“textfields-title”>Brand
<td align=“center”
class=“textfields-title”>Re-Order #
<td align=“center”
class=“textfields-title”>Description
</table></td>
</tr>
<script>
draw();
</script>
<tr>
<td height="40" colspan="2" align="left"
valign=“middle”> <input name=“Submit” type=“button”
class=“buttons” onclick=“draw();” value=“Add Another Brand” />
<td height=“20” colspan=“2” align=“left”
valign=“middle” class=“textfields-title”> Message
<td height=“40” colspan=“2” align=“left”
valign=“middle”> <textarea name=“textarea” cols=“80” rows=“3”
class=“textfields” >
<tr>
<td height="40" colspan="2" align="left"
valign=“middle”> <input name=“Submit2” type=“submit”
class=“buttons” value=“Submit” />
<input name=“reset” type=“reset”
class=“buttons” value=“Reset” />
<input
name=“send_mail” type=“hidden” value="" />
<?
}
?>
<td height=“22” align=“center” valign=“top” bgcolor="#46659B"
class=“copyright”><table width=“100%” border=“0” cellspacing=“0”
cellpadding=“0”>
<td height=“22” align=“center” valign=“top” bgcolor="#46659B"
class=“copyright”>Copyright © 2006 Tonerplus Surplus. All Rights
Reserved.
<td height=“30” align=“center” valign=“middle”
bgcolor="#FFFFFF" class=“designed”>Designed and Hosted by : <a
href=“http://www.NO-DOMAIN.xxx/”>www.NO-DOMAIN.xxx
<td height=“45” align=“center” valign=“middle”
bgcolor="#FFFFFF" class=“designed”><img
src=“http://www.NO-DOMAIN.xxx/images/poweredby.gif” border=“0” />
//
[/php]
Admin Edit: Added PHP code tags for readability