Moshambi
08-21-2008, 09:41 AM
ok so I am using XAMPP and trying to send an email to myself here is my code:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$body = $_POST['body'];
if ($name != "" AND $email != "" AND $body != "") {
//PUT YOUE EMAIL ADDRESS -----
$sendto = "myemail@blah.com";
//PUT YOUR EMAIL ADDRESS -----
$subject = "Email from site!";
$message = "This is a message from your site
From: $name
Email: $email
Message: $body";
// send the mail
mail("$sendto", "$subject", "$message","mosh");
echo "Your message was sent";
}
?><form method="post" name="mailform" action="<?=$_SERVER['PHP_SELF'] ?>">
<table width="200" border="0" cellspacing="0">
<tr>
<td width="62">Name:</td>
<td width="134">
<input name="name" type="text" id="name">
</td>
</tr>
<tr>
<td>Email:</td>
<td><input name="email" type="text" id="email"></td>
</tr>
<tr>
<td valign="top">Message:</td>
<td><textarea name="body" cols="45" rows="10"></textarea></td>
</tr>
</table>
<br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Submit2" value="Reset">
</form>
I dont think there is anything wrong with the code snippet because i got it from a reliable source: http://www.dreamincode.net/code/browse.php?cid=1
but here is the error i keep getting when i try to run it:
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in
I tried messing with the php.ini file but that got me no where (probably cuz i have no idea what to do with it)
Any help with this problem would be very appreciated. Thank You in advance!
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$body = $_POST['body'];
if ($name != "" AND $email != "" AND $body != "") {
//PUT YOUE EMAIL ADDRESS -----
$sendto = "myemail@blah.com";
//PUT YOUR EMAIL ADDRESS -----
$subject = "Email from site!";
$message = "This is a message from your site
From: $name
Email: $email
Message: $body";
// send the mail
mail("$sendto", "$subject", "$message","mosh");
echo "Your message was sent";
}
?><form method="post" name="mailform" action="<?=$_SERVER['PHP_SELF'] ?>">
<table width="200" border="0" cellspacing="0">
<tr>
<td width="62">Name:</td>
<td width="134">
<input name="name" type="text" id="name">
</td>
</tr>
<tr>
<td>Email:</td>
<td><input name="email" type="text" id="email"></td>
</tr>
<tr>
<td valign="top">Message:</td>
<td><textarea name="body" cols="45" rows="10"></textarea></td>
</tr>
</table>
<br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Submit2" value="Reset">
</form>
I dont think there is anything wrong with the code snippet because i got it from a reliable source: http://www.dreamincode.net/code/browse.php?cid=1
but here is the error i keep getting when i try to run it:
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in
I tried messing with the php.ini file but that got me no where (probably cuz i have no idea what to do with it)
Any help with this problem would be very appreciated. Thank You in advance!