...

View Full Version : Sending Mail In PHP, Error (Failed To Receive), what does that mean?



l3vi
05-02-2004, 11:41 PM
I keep getting this error when I attempt trying to send a "Home Request"

arning: mail(): Failed to Receive in C:\Documents and Settings\l3vi\My Documents\Web Documents\Projects\Server User Interface\Paula Osborne\Functions\send.php on line 26
Due An Error, Your Home Request Could Not Be Sent!

Here is my Code (this first one is send.php)


<?php
if($_POST['type'] == "Home Request"){

$to = $_POST['to'];
$from = $_POST['from'];
$subject = "Test!";
$message = "Name: $from\nCurrent Address: $_POST[address]\nCity: $_POST[City]\nState: $_POST[State]\nZip: $_POST[Zip]\n\nHome Phone: $_POST[Phone1]\nWork Phone: $_POST[Phone2]\nEmail: $_POST\n\nRelocation Date: $_POST[DTE]\nBeds: $_POST[beds]\nBaths: $_POST[baths]\nSquare Feet: $_POST[sf]\nPrice Range: $_POST[PR]\n";

}elseif($_POST['type'] == "Email"){

$to = $_POST['to'];
$from = $_POST['from'];
$subject = $_POST['subject'];
$message = $_POST['message'];

}
?>
<center>
<font size="5pt">
<b>Sending <?php echo $_POST['type']; ?>...</b>
</font>
</center>
<br />
<center>
<?php
$sent = mail("$to","$subject","$message","From: $from");
if($sent){
echo "Your $_POST[type] Was Successfully Sent!";
}else{
echo "Due An Error, Your $_POST[type] Could Not Be Sent!";
}
?>


Here is my code for the form:



<center>
<font size="5pt">
<b>Request a Home (UNDER CONSTRUCTION)</b>
</font>
</center>
<br />

<div class="cntrp">
<form action="./index.php?page=functions.send" method="POST">
<div class="emlfrm">
<input type="hidden" name="type" value="Home Request">
<input type="hidden" name="to" value="paula.osborne@coldwellbanker.com">
<b>Your Name</b>: <input type="text" name="from" value="Your Name" style="width:199px;border:1px solid #173767;background-color:#FFFFFF;padding-left:2px;padding-right:2px;text-align:left;"><br />
<b>Current Address</b>: <input type="text" name="address" value="Address" style="width:185px;border:1px solid #173767;background-color:#FFFFFF;padding-left:2px;padding-right:2px;text-align:left;"><br />
<b>City</b>: <input type="text" name="City" value="City" style="width:185px;border:1px solid #173767;background-color:#FFFFFF;padding-left:2px;padding-right:2px;text-align:left;"><br />
<b>State</b>: <input type="text" name="State" value="State" style="width:185px;border:1px solid #173767;background-color:#FFFFFF;padding-left:2px;padding-right:2px;text-align:left;"><br />
<b>Zip</b>: <input type="text" name="Zip" value="Zip" style="width:185px;border:1px solid #173767;background-color:#FFFFFF;padding-left:2px;padding-right:2px;text-align:left;"><br />
<b>Home Phone</b>: <input type="text" name="Phone1" value="555-555-5555" style="width:185px;border:1px solid #173767;background-color:#FFFFFF;padding-left:2px;padding-right:2px;text-align:left;"><br />
<b>Work Phone</b>: <input type="text" name="Phone2" value="555-555-5555" style="width:185px;border:1px solid #173767;background-color:#FFFFFF;padding-left:2px;padding-right:2px;text-align:left;"><br />
<b>Your Email</b>: <input type="text" name="Email" value="yourname@yourname.com" style="width:185px;border:1px solid #173767;background-color:#FFFFFF;padding-left:2px;padding-right:2px;text-align:left;"><br />
<b>Relocation Date</b>: <input type="text" name="DTE" value="MM/DD/YY" style="width:185px;border:1px solid #173767;background-color:#FFFFFF;padding-left:2px;padding-right:2px;text-align:left;"><br />
<b>Beds</b>: <input type="text" name="beds" value="# of Beds" style="width:185px;border:1px solid #173767;background-color:#FFFFFF;padding-left:2px;padding-right:2px;text-align:left;"><br />
<b>Baths</b>: <input type="text" name="baths" value="# of Baths" style="width:185px;border:1px solid #173767;background-color:#FFFFFF;padding-left:2px;padding-right:2px;text-align:left;"><br />
<b>Square Feet</b>: <input type="text" name="sf" value="# of Square Feet" style="width:185px;border:1px solid #173767;background-color:#FFFFFF;padding-left:2px;padding-right:2px;text-align:left;"><br />
<b>Price Range</b>:
<select name="PR">
<option value="1">$0 - $40,000
<option value="2">$41,000 - $80,000
<option value="3">$81,000 - $120,000
<option value="4">$121,000 - $160,000
<option value="5">$161,000 - $200,000
<option value="6">$201,000 - $240,000
<option value="7">$241,000 - $300,000
<option value="8">Above $300,000
</select>
<br />
<br />
<input type="submit" value="Email Me!">

</div>
</form>
</div>


And here is the code for the email me form:



<center>
<font size="5pt">
<b>Email Me</b>
</font>
</center>
<br />

<div class="cntrp">
<form action="./index.php?page=functions.send" method="POST">
<div class="emlfrm">
<input type="hidden" name="type" value="Email">
<b>To</b>: [email]paula.osborne@coldwellbanker.com<input type="hidden" name="to" value="paula.osborne@coldwellbanker.com"><br />
<b>From</b>: <input type="text" name="from" value="yourname@youremail.com" style="width:199px;border:1px solid #173767;background-color:#FFFFFF;padding-left:2px;padding-right:2px;text-align:left;"><br />
<b>Subject</b>: <input type="text" name="subject" value="Test Subject" style="width:185px;border:1px solid #173767;background-color:#FFFFFF;padding-left:2px;padding-right:2px;text-align:left;"><br />
<b>Message</b>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<textarea name="message" style="width:242px;height:150px;border:1px solid #173767;background-color:#FFFFFF;">
Your Message To Me, Here!
</textarea>
<br />
<div class="cntr">
<input type="submit" value="Email Me!">
</div>
</div>
</form>
</div>


The email works. I could get the page to send the email, but the home request doesnt work.

Thanks a bunch for any help... :thumbsup:

gsnedders
05-03-2004, 01:10 AM
You may want to try this: //www.scriptarchive.com/formmail.html

l3vi
05-03-2004, 01:12 AM
Thnx but no thnx... I already have the Email Me portion of the script to work. It sends me an email, but the stupid request a home portion of the code doesnt work. It should be the same tho....

BTW, the page I am using it on is linked to in my siggy...

gsnedders
05-03-2004, 01:27 AM
What's in send.php?

l3vi
05-03-2004, 01:28 AM
send.php is the very first php code I posted...

gsnedders
05-03-2004, 01:32 AM
try using send.php unless you have reason not to...

l3vi
05-03-2004, 01:33 AM
I do use send.php

I use all three of the files I just posted :eek:

gsnedders
05-03-2004, 01:35 AM
I mean using send.php instead of ./index.php?page=functions.send

l3vi
05-03-2004, 01:38 AM
it cant just use send.php the way I do it.. It works, sort of. I have it working for the email me part. That part works. The part that doesnt work is the request a home. THey both use the same script, as u can see, if u look at the send.php source. I just want to know how I can get it to work for both. It should work, but it doesnt...

Im confuuzeeddddddd :crazy:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum