View Full Version : email php on windows xp

07-04-2005, 05:03 AM
hi, i'm new to php and i'm going a major project of php email for my school's major project. i've encounted some problems:

1) i'm not sure whether my codes are correct
2) i'm not sure whether if the hosting server does not support mail function, can i still use the mail function

i've been cracking my brain on that for quite some time.


my php code loooks like this:

if(($_GET['sender_name'] == "") || ($_GET['sender_email'] == "") || ($_GET['message'] == "")){

$email = $_REQUEST['sender_email'] ;
$name = $_REQUEST['sender_name'] ;
$message = $_REQUEST['message'] ;

if (@mail("myaddress@domain.com","PBL Help Desk",$message))
echo 'Your request have been submitted.';
echo '(Sorry, there has been an error...)';

$subject="PBL Help Desk";

$msg="E-MAIL SENT FROM PBL Site\n";
$msg.="Sender's Name:\t$_POST[sender_name]\n";
$msg.="Sender's E-Mail:\t$_POST[sender_email]\n";

$mailheaders="From: My Site <myaddress@domaine.com>\n";
$mailheaders.="Reply-To: $_POST[sender_email]\n";
$mailheaders.="Message: $_POST[message]\n";


<title>Online PBL Survival Kit</title>
<H1>You have entered the following information:</H1>
<p><strong>Your Name:</strong><br>
<? echo "$_GET[sender_name]"; ?>

<p><strong>Your Email Address:</strong><br>
<? echo "$_GET[sender_email]"; ?>

<? echo "$_GET[message]"; ?>



and my html code looks like this:

<form action="helpdesk.php" method="GET" name="HelpDesk" id="HelpDesk">
<p>From: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="sender_name" type="text" id="sender_name" size="20">
Your Email Address: &nbsp;&nbsp;
<input name="sender_email" type="text" id="sender_email" size="30">
Your message</p>
<textarea name="message" cols="50" wrap=virtual rows="10" id="message"></textarea>
<p align="center">
<input type="submit" name="Submit" value="Submit">
<input name="Reset" type="submit" id="Reset" value="Reset">


all the naming is correct and i am not sure what went wrong. when i click the submit button with all the fills filled, it printed all the error message together with the information that i've input in

anyone please help out

07-04-2005, 08:02 AM
if (@mail("myaddress@domain.com","PBL Help Desk",$message))The @ is suppressing any useful error messages, all you know from the error message generated by the code is that the mail didn't send, remove the @ and try the script and post back the error message it generates. If the server doesn't allow mail() then you can't use it, but the error may tell you if that's the problem here or something else.

07-04-2005, 12:26 PM
Check you have an smtp server installed on the system