Page 1 of 1

help with send mail form

Posted: Mon Sep 14, 2009 10:38 pm
by aladiyat23
Hi,
I modified some old code of mine and cant get a form to work.. can someone look at it and see what I'm missing?

Here's my send code:

Code: Select all

 
<?php
$to = "REMOVED@gmail.com";
$subject = "Proposal Request";
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$website=$_POST['website'];
$time=$_POST['time'];
$more=$_POST['more'];
$company=$_POST['company'];
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
 
$message = "
   Name:$name\n
   Phone: $phone\n
   Best Time to Call: $time\n
   Website: $website\n
   Company: $company\n
   Project Details: $more\n";
   
if($sent)
{
   echo '<META HTTP-EQUIV="REFRESH" CONTENT="1;URL=http://www.REMOVED.html">'; }
else
{
   echo "Mail returned false: ".$sent; }
 
?>
Here's my form (just a snippet):

Code: Select all

 
<form action="http://removed.php" method="post">                        
<label class="description">Name </label>
<input name="name" id="name" class="element text" maxlength="255" value="" size="36" type="text"/>
 
<label class="description">Email </label>
<input name="email" id="email" class="element text medium" type="text" maxlength="255" value=""/> 
 
Im getting a mail returned false error...

Any help is greatly appreciated.. THANKS!

Re: help with send mail form

Posted: Mon Sep 14, 2009 11:39 pm
by Eric!
Do you have a SMTP mail installed on this server? What was the values of $sent?

Re: help with send mail form

Posted: Mon Sep 14, 2009 11:57 pm
by aladiyat23
SMTP is set to localhost, I'm sorry.. what do you mean by the value of $sent? When I hit submit, its echoing the error "mail returned false"
Sorry, my php is limited that's why I reuse everything and just tweek.

Thank you!

Re: help with send mail form

Posted: Tue Sep 15, 2009 8:00 am
by Eric!
add this to the top of your php file:

Code: Select all

error_reporting(E_ALL);
Try this on line 13 instead:

Code: Select all

$sent=mail("youremail@whatever.com","Subject","Hello.");
and see if that gets through as an experiment.

Re: help with send mail form

Posted: Tue Sep 15, 2009 10:26 am
by aladiyat23
I added the error reporting line and still getting same echo "Mail returned false:" and thats it

I also changed the $sent info

Thank you! :)

Re: help with send mail form

Posted: Tue Sep 15, 2009 6:58 pm
by Eric!
aladiyat23 wrote:I also changed the $sent info

Thank you! :)
So did the new mail() statement work or not? If not, I suggest you check with your host provider to see if an SMTP server is running on your host and is configured for PHP.