PDA

View Full Version : mail script problem


ilinemedia
02-01-2008, 07:07 PM
I have used a similar code for my website and although when you click submit it redirects me to the right page the form isn't being sent to my email. Please help!

PHP Code:
<?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'Contact Form';

// Your email address. This is where the form information will be sent.
$emailadd = 'ilinemedia@hotmail.com';

// Form Address.
$url = 'http://www.ilinemedia.info/contactme.html';

// Where to redirect after form is processed.
$url = 'http://www.ilinemedia.info';

// 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 = '0';

// --------------------------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: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?> html code:
<form id="form1" name="form1" method="post" action="http://www.ilinemedia.info/sendresults.php">
<table width="450">
<tr>
<th width="105" align="right" valign="top" scope="row"><label for="CustomerName"><span class="style4">Name</span>:</label></th>
<td width="263"><input name="CustomerName" type="text" class="textfield" id="CustomerName" size="25" maxlength="50" /></td>
</tr>
<tr>
<th align="right" valign="top" scope="row"><label for="CompanyName" class="style4">Company:</label></th>
<td><input name="CompanyName" type="text" class="textfield" id="CompanyName" size="25" maxlength="50" /></td>
</tr>
<tr>
<th align="right" valign="top" scope="row"><label for="EmailAddress" class="style4">Email:</label></th>
<td><input name="EmailAddress" type="text" class="textfield" id="EmailAddress" size="25" maxlength="50" /></td>
</tr>
<tr>
<th align="right" valign="top" scope="row"><label for="CommentReply" class="style4">Comments:</label></th>
<td><textarea name="CommentReply" cols="40" rows="4" class="textfield" id="CommentReply"></textarea></td>
</tr>
<tr>
<th align="right" valign="top" scope="row">&nbsp;</th>
<td><label for="Send"></label>
<input type="submit" name="Send" id="Send" value="Contact Us" /></td>
</tr>
</table>
</form>

davidj
02-17-2008, 11:29 PM
did you get this sorted