Senting email with php
-
I am using a contact form in my website and I need to sent the details to a particular email in the same server as email.
My hosting provider shared the below code ,but I don’t know how and where to use this.
Please help.<?
$mailto=”[email protected]”;
$pcount=0;
$gcount=0;
$subject = “Mail from Enquiry Form”;$from=”[email protected]”;
while (list($key,$val)=each($_POST))
{
$pstr = $pstr.”$key : $val \n “;
++$pcount;}
while (list($key,$val)=each($_GET))
{
$gstr = $gstr.”$key : $val \n “;
++$gcount;}
if ($pcount > $gcount)
{
$message_body=$pstr;
mail($mailto,$subject,$message_body,”From:”.$from);
echo “Mail has been sent”;
}
else
{
$message_body=$gstr;
mail($mailto,$subject,$message_body,”From:”.$from);
echo “Mail has been sent”;
}
?>
- The topic ‘Senting email with php’ is closed to new replies.