Hi, I was designing a mail script so i have a sample that came with my mail server
[php] <?
$mailto="[email protected]";
$file="thanks.htm";
$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);
include("$file");
}
else
{
$message_body=$gstr;
mail($mailto,$subject,$message_body,"From:".$from);
include("$file");
}
?>[/php]
and thats the help content that came along
If your domain name is abc.com, then you would define the From email address as [email protected].This email address need not be existing on the mail server of abc.com, however, the domain name in the $from field has to be yours.
You may use an email address such as [email protected].
The value in the $mailto field needs to be changed to the email address, where the email containing the data submitted through the form needs to be delivered.
Once the visitor provides feedback, he/she can then be re-directed to another page on your website. In order to achieve this, you need to mention the path to the HTML file in the $file field in the script. Alternatively, you can display a message to the visitor thanking him/her for the feedback. Such messages can be displayed in a new page like thanks.htm. Such a page can also contain other information as deemed necessary.
and here are the changes i made
[php]<?
$mailto="******";
$file="thanks.html";
$pcount=0;
$gcount=0;
$subject=$_POST['subject'];
$from="******";
$header="from: $name $mailfrom";
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,$header);
include("$file");
}
else
{
$message_body=$gstr;
mail($mailto,$subject,$message_body,"From:".$from);
include("$file");
}
?>[/php]
and for some reason the mail is not being sent… I’d appreciate the help