PDA

View Full Version : Php email form help


designer_282
09-06-2011, 04:27 PM
I'm having issues the php email form on the tutorials page. Well, everything works fine except that it doesn't send an email.

Here's the code:


//--------------------------Set*these*paramaters--------------------------

//*Subject*of*email*sent*to*you.
$subject*=*'Results*from*Contact*form';*

//*Your*email*address.*This*is*where*the*form*inform ation*will*be*sent.*
$emailadd*=*'';*

//*Where*to*redirect*after*form*is*processed.*
$url*=*'';*

//*Makes*all*fields*required.*If*set*to*'1'*no*field *can*not*be*empty.*If*set*to*'0'*any*or*all*fields *can*be*empty.
$req*=*'1';*

//*--------------------------Do*not*edit*below*this*line--------------------------
$text*=*"Results*from*form:\n\n";*
$space*=*'*';
$line*=*'
';
foreach*($_POST*as*$key*=>*$value)
{
if*($req*==*'1')
{
if*($value*==*'')
{echo*"$key*is*empty";die;}
}
$j*=*strlen($key);
if*($j*>=*20)
{echo*"Name*of*form*element*$key*cannot*be*longer*than*20 *characters";die;}
$j*=*20*-*$j;
for*($i*=*1;*$i*<=*$j;*$i++)
{$space*.=*'*';}
$value*=*str_replace('\n',*"$line",*$value);
$conc*=*"{$key}:$space{$value}$line";
$text*.=*$conc;
$space*=*'*';
}
mail($emailadd,*$subject,*$text,*'From:*'.$emailad d.'');
echo*'.$url.'">';
?>


I've removed my email and url parameters since it's no ones business what those are..

I just don't understand why it won't send the email...Is the code defective??

p.s. I don't know and barely understand php, so any help is appreciated!

edbr
09-07-2011, 02:20 AM
dont understand all the *'s, they would make it fail

designer_282
09-07-2011, 12:52 PM
Thank you! It seems like it was my email that was the problem. I know typed it in correctly, but nevertheless I changed it and now its working fine. ;)