Question : PHP hosting transfer problem

I have a php script that allows someone to fill out a form and attach a photo.
When they submit the form it emails the field values and the photo as an attachment to my email address. I'm trying to set this up on a friend of mine's server for him so he can use it too but I'm going from my LAMP environment to a Go Daddy shared Windows IIS7 environment. All Said and done the script won't send the email :(

PHPinfo is available in PM

I've Attached to source code for the form below

please help!
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:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
<?php


include("header.html");
@$comment = addcslashes($_POST['Name']);
@$Name = addslashes($_POST['Name']);
@$email = addslashes($_POST['email']);
@$upload_Name = $_FILES['upload']['name'];
@$upload_Size = $_FILES['upload']['size'];
@$upload_Temp = $_FILES['upload']['tmp_name'];
@$upload_Mime_Type = $_FILES['upload']['type'];
@$Date =  addslashes($_POST['Date']);
@$Description =  addslashes($_POST['Description']);
@$People =  addslashes($_POST['People']);

function RecursiveMkdir($path)
 {
   if (!file_exists($path)) 
   { 
      RecursiveMkdir(dirname($path));
      mkdir($path, 0777);
    }
  }


if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))
{
echo("<div style='position: absolute; top: 200px; left: 125px; z-index: 500;'><p align='center'><b>Please enter a valid email<br /><br /><a href='popup.html'>Go Back</a></p></div>");
include("footer.html");
die();
}

if( $upload_Size == 0)
{
echo("<div style='position: absolute; top: 200px; left: 50px; z-index: 500;'><p align='center'><b>ERROR</b><br />YOUR FILE WAS NOT UPLOADED<br />PLEASE CHECK THE FILE SIZE AND FORMAT<br /><br /><a href='popup.html'>Go Back</a></p></div>");
include("footer.html");
die();
}


// CHANGE THIS TO A HIGHER OR LOWER VALUE - REMEMBER HOSTING LIMITS
if( $upload_Size >2000000)
//--------
{
unlink($upload_Temp);
echo("<div style='position: absolute; top: 200px; left: 50px; z-index: 500;'><p align='center'><b>ERROR</b><br>YOUR FILE WAS NOT UPLOADED<br>PLEASE CHECK THE FILE SIZE AND FORMAT<br /><br /><a href='popup.html'>Go Back</a></p></div>");
include("footer.html");
die();
}
if( $upload_Mime_Type != "image/cgm" AND $upload_Mime_Type != "image/g3fax" AND $upload_Mime_Type != "image/gif" AND $upload_Mime_Type != "image/ief" AND $upload_Mime_Type != "image/pjpeg" AND $upload_Mime_Type != "image/jpeg" AND $upload_Mime_Type != "image/naplps" AND $upload_Mime_Type != "image/png" AND $upload_Mime_Type != "image/prs.btif" AND $upload_Mime_Type != "image/prs.pti" AND $upload_Mime_Type != "image/tiff" AND $upload_Mime_Type != "image/vnd.cns.inf2" AND $upload_Mime_Type != "image/vnd.dwg" AND $upload_Mime_Type != "image/vnd.dxf" AND $upload_Mime_Type != "image/vnd.fastbidsheet" AND $upload_Mime_Type != "image/vnd.fpx" AND $upload_Mime_Type != "image/vnd.fst" AND $upload_Mime_Type != "image/vnd.fujixerox.edmics-mmr" AND $upload_Mime_Type != "image/vnd.fujixerox.edmics-rlc" AND $upload_Mime_Type != "image/vnd.mix" AND $upload_Mime_Type != "image/vnd.net-fpx" AND $upload_Mime_Type != "image/vnd.svf" AND $upload_Mime_Type != "image/vnd.wap.wbmp" AND $upload_Mime_Type != "image/vnd.xiff" )
{
unlink($upload_Temp);
echo("<div style='position: absolute; top: 200px; left: 50px; z-index: 500;'><p align='center'><b>ERROR</b><br>YOUR FILE WAS NOT UPLOADED<br>PLEASE CHECK THE FILE SIZE AND FORMAT<br /><br /><a href='popup.html'>Go Back</a></p></div>");
include("footer.html");
die();
}
$uploadFile = "uploads/".$upload_Name ;
if (!is_dir(dirname($uploadFile)))
  {
    @RecursiveMkdir(dirname($uploadFile)); 
  }
else
  {
  @chmod(dirname($uploadFile), 0777);
  }
@move_uploaded_file( $upload_Temp , $uploadFile); 
chmod($uploadFile, 0644);

//CHANGE THIS TO THE YOUR DOMAIN
$upload_URL = "http://upload.**********.org/".$upload_Name ;
//------------

$pfw_header = "From: $email";
$pfw_subject = "AN IMAGE HAS BEEN UPLOADED";
$pfw_random_hash = md5(date('r', time()));
// CHANGE THIS TO YOUR EMAIL ADDRESS
$pfw_email_to = "John********@*****.com";
$pfw_header .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
//read the atachment file contents into a string,
//encode it with MIME base64,
//and split it into smaller chunks
$attachment = chunk_split(base64_encode(file_get_contents("$uploadFile")));
//define the body of the message.
ob_start(); //Turn on output buffering
?>
--PHP-mixed-<?php echo $random_hash; ?> 
Content-Type: multipart/alternative; boundary="PHP-alt-<?php echo $random_hash; ?>"

--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<?php echo $Name; ?> from <?php echo $email; ?><br />
Sent you an image which was taken <?php echo $Date; ?>
<br /><br />
<i>"<?php echo $Description; ?>"</i>
<br /><br />
The people in this photo are;<br />
<?php echo $People; ?>

/* The attached comment is <?php $comment; ?> */

--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

<b><?php echo $Name; ?></b> from <a href="mailto:<?php echo $email; ?>"><?php echo $email; ?></a><br />
Sent you an image which was taken <?php echo $Date; ?>
<br /><br />
<i>"<?php echo $Description; ?>"</i>
<br /><br />
The people in this photo are;<br />
<?php echo $People; ?>

<!-- The attached comment is: <?php $comment; ?> -->

--PHP-alt-<?php echo $random_hash; ?>--

--PHP-mixed-<?php echo $random_hash; ?> 
Content-Type: image/png; name="<?php echo $upload_Name;?>" 
Content-Transfer-Encoding: base64 
Content-Disposition: attachment 

<?php echo $attachment; ?>
--PHP-mixed-<?php echo $random_hash; ?>--

<?php
//copy current buffer contents into $message variable and delete current output buffer
$pfw_message = ob_get_clean();
//send the email
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;

 echo("<div style='position: absolute; top: 200px; left: 125px; z-index: 500;'><p align='center'><b>THANK YOU!<br>YOUR IMAGE HAS BEEN UPLOADED</div></b></p>");
include("footer.html");
?>
<?php unlink($uploadFile); ?>

Answer : PHP hosting transfer problem

Here is an email form that is running on Goddady's IIS7 hosting, also works on Linux also.  The order of items in the header is important and '\r\n' is required at the end of each header line.  Also MIMETYPE is required I believe.
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:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
<?php
# some settings of POST vars
if (!isset($_POST['state']))  $state = ''; else $state = $_POST['state'];
if (!isset($_POST['toText'])) $toText = ''; else $toText = $_POST['toText'];
if (!isset($_POST['subjectText'])) $subjectText = ''; else $subjectText = $_POST['subjectText'];
if (!isset($_POST['msgText'])) $msgText = ''; else $msgText = $_POST['msgText'];
if (!isset($_POST['ccText'])) $ccTexth = ''; else $ccText = $_POST['ccText'];
if (!isset($_POST['bccText'])) $bccText = ''; else $bccText = $_POST['bccText'];
if (!isset($_POST['nameText'])) $nameText = ''; else $nameText = $_POST['nameText'];
if (!isset($_POST['fromText'])) $fromText = ''; else $fromText = $_POST['fromText'];

if ($state == "") {
    $title="Test Email Page";
    $announce="---";
}
else {
//  $ccText="";
  $toText="[email protected]";
	$title="Test Email Page";
  $announce="Your Message has been Sent!";
	$header = "MIME-Version: 1.0\r\n";
	$header .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
	$header .= "From: ".$fromText."\r\n";
	$header .= "Cc: ".$ccText."\r\n";
//	$header .= "Reply-To : ".$fromText."\r\n";
	$header .= "X-Priority: 1\r\n";
	$header .= "X-Mailer: PHP\r\n\r\n";
//	ini_set(sendmail_from,$fromText);  
	mail($toText, $subjectText, $msgText, $header);
//	ini_restore(sendmail_from);
}
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><?php echo($title)?></title>
<style type="text/css">
<!-- 
A:link { color: #999999; }
A:visited { color: #999999; }
A:hover {color: #0099ff;}
-->
</style>

</head>

<body bgcolor="#ddeedd">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" summary="" width="580">
<tr><td align="center">

<?php
   	echo ("State: ".$state."&nbsp;&nbsp;To: ".$toText."<br>\nSubject: ".$subjectText."<br>\n".$msgText."<br>\ncc: ".$header);
?>

<p><b><font color="#000000" size="5">Test Email</font></b></p>
<font size="4" color="#000000">

<!--   <form method="POST" action="<?php echo($PHP_SELF)?>"> -->
  <form method="POST" action="Email.php">
    <p><font size="3"><b>Name: <input type="text" name="nameText" size="46"></b></font></p>
    <p><font size="3"><b>Email: <input type="text" name="fromText" size="46"></b></font></p>
    <input type="hidden" name="subjectText" value="Web Mail"></p>
    <input type="hidden" name="mailformat" value="Text"></p>
    <p><font face="Arial" size="3"><b>Message Text:</b></font></p>
    <p><font face="Arial" size="3"><b><textarea rows="6" name="msgText" cols="60"></textarea></b></font></p>
    <p><font size="3"><b><input type="submit" value="Send" name="send" style="font-family: Arial; font-size: 12pt; font-weight: bold"></b></font></p>
    <input type="hidden" name="state" value="1">
  </form>
  <b><font face="Arial" size="4" color="#e00000"><?php echo($announce)?></font></b><br><br>

<input type=button value="Or Cancel - close This Window" onClick="javascript:window.close();">

</font>
</td></tr>
</table> 
</div>


</body>
</html>
Random Solutions  
 
programming4us programming4us