<?php
function spamcheck($field)
{
$field=filter_var($field, FILTER_SANITIZE_EMAIL);
if(filter_var($field, FILTER_VALIDATE_EMAIL))
{
return TRUE;
}
else
{
return FALSE;
}
}
if (isset($_REQUEST['email']))
$mailcheck = spamcheck($_REQUEST['email']);
if ($mailcheck==FALSE)
{
echo "Invalid input";
}
else
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail("my-email", "Subject: $subject",
$message, "From: $email" );
echo "Thank you for using our mail form";
}
}
else
echo "
<form method='post' action='submit.php'>
<table>
<tr>
<td>
<i style='color:#FFFFFF'>E-Mail (<b style='color:red'>*</b>)</i>
</td>
<td>
<input type='text' name='email' />
</td>
</tr>
<tr>
<td>
<i style='color:#FFFFFF'>Subject</i>
</td>
<td>
<input type='text' name='subject' />
</td>
</tr>
<tr>
<td valign='top'>
<i style='color:#FFFFFF'>Message (<b style='color:red'>*</b>)</i>
</td>
<td>
<textarea rows='15' cols='40' name='message'></textarea>
</td>
</tr>
<tr>
<td>
<!--Empty Cell-->
</td>
<td valign='right'>
<input type='submit' />
</td>
</tr>
</table>
</form>";
}
?>
The form above is supposed to send email it has no errors apparently php doesn't report any and I have show errors turned on in the php ini file. The smtp server section in the php ini file is set to talk talks smtp address which has been verified. The return email address is set to my yahoo address can I do this.
Also am I allowed to send e-mail even if my site is not live it is on a server the apache server but uses local host at the min I'm getting a domain name soon. The thing is e-mail clients are just static programs on a computer so how do they do it if this is the case.
About the form being in a table I have seen this done else were so prosume it can work. Not sure though.
Thanks for any help
function spamcheck($field)
{
$field=filter_var($field, FILTER_SANITIZE_EMAIL);
if(filter_var($field, FILTER_VALIDATE_EMAIL))
{
return TRUE;
}
else
{
return FALSE;
}
}
if (isset($_REQUEST['email']))
$mailcheck = spamcheck($_REQUEST['email']);
if ($mailcheck==FALSE)
{
echo "Invalid input";
}
else
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail("my-email", "Subject: $subject",
$message, "From: $email" );
echo "Thank you for using our mail form";
}
}
else
echo "
<form method='post' action='submit.php'>
<table>
<tr>
<td>
<i style='color:#FFFFFF'>E-Mail (<b style='color:red'>*</b>)</i>
</td>
<td>
<input type='text' name='email' />
</td>
</tr>
<tr>
<td>
<i style='color:#FFFFFF'>Subject</i>
</td>
<td>
<input type='text' name='subject' />
</td>
</tr>
<tr>
<td valign='top'>
<i style='color:#FFFFFF'>Message (<b style='color:red'>*</b>)</i>
</td>
<td>
<textarea rows='15' cols='40' name='message'></textarea>
</td>
</tr>
<tr>
<td>
<!--Empty Cell-->
</td>
<td valign='right'>
<input type='submit' />
</td>
</tr>
</table>
</form>";
}
?>
The form above is supposed to send email it has no errors apparently php doesn't report any and I have show errors turned on in the php ini file. The smtp server section in the php ini file is set to talk talks smtp address which has been verified. The return email address is set to my yahoo address can I do this.
Also am I allowed to send e-mail even if my site is not live it is on a server the apache server but uses local host at the min I'm getting a domain name soon. The thing is e-mail clients are just static programs on a computer so how do they do it if this is the case.
About the form being in a table I have seen this done else were so prosume it can work. Not sure though.
Thanks for any help