i created a php page which will prompt he user to enter from id, to id, subject and message. once the details are entered, and submit button is clicked, the mail is sent to the id entered in to id field.
when i enter my yahoo id in from id, i am able to send mail to any one.you dont believe me but when i entered my friends id in the to id field and another friends id in from id, the mail was sent to my friend from my friend. but i sent the mail. how did this happen.
my code is as follows
<?php
if ( isset($_REQUEST["txtFromEmail"])
&& isset($_REQUEST["txtToEmail"])
&& isset($_REQUEST["txtSubject"])
&& isset($_REQUEST["txtMessage"]))
{
$thetext="";
sendmail();
}
else
echo "enter data in all fields";
function sendmail()
{
$to = $_REQUEST["txtToEmail"];
$subject = $_REQUEST["txtSubject"];
$message = $_REQUEST["txtMessage"];
$from = $_REQUEST["txtFromEmail"];
$headers = "From: " . $_REQUEST["txtFromEmail"];
mail($to,$subject,$message,$headers);
echo "<br><br><Br>Mail Sent.";
}
?>
<html>
<form method="post" action="<?php echo $php_self ?>">
<br>
From : <input type="text" name="txtFromEmail"><br>
To : <input type="text" name="txtToEmail"><br>
Subject : <input type="text" name="txtSubject"><br>
Message : <input type="text" name="txtMessage"><br>
<input type="submit" name="btn"
value="Send Mail">
<input type="hidden" name="sometext"
value="<?php echo $thetext ?>" >
</form>
</html>
my php is in linux server and im running it from windows
if the original sender is unknown then this mail() could create blunders.
is there any way with which the person who received the mail will find the identity or mail id or ip-address of the original sender.
if i dont type any thing in from id then the mail is sent and the at the receivers side the from id is "Apache" what does it mean
when i enter my yahoo id in from id, i am able to send mail to any one.you dont believe me but when i entered my friends id in the to id field and another friends id in from id, the mail was sent to my friend from my friend. but i sent the mail. how did this happen.
my code is as follows
<?php
if ( isset($_REQUEST["txtFromEmail"])
&& isset($_REQUEST["txtToEmail"])
&& isset($_REQUEST["txtSubject"])
&& isset($_REQUEST["txtMessage"]))
{
$thetext="";
sendmail();
}
else
echo "enter data in all fields";
function sendmail()
{
$to = $_REQUEST["txtToEmail"];
$subject = $_REQUEST["txtSubject"];
$message = $_REQUEST["txtMessage"];
$from = $_REQUEST["txtFromEmail"];
$headers = "From: " . $_REQUEST["txtFromEmail"];
mail($to,$subject,$message,$headers);
echo "<br><br><Br>Mail Sent.";
}
?>
<html>
<form method="post" action="<?php echo $php_self ?>">
<br>
From : <input type="text" name="txtFromEmail"><br>
To : <input type="text" name="txtToEmail"><br>
Subject : <input type="text" name="txtSubject"><br>
Message : <input type="text" name="txtMessage"><br>
<input type="submit" name="btn"
value="Send Mail">
<input type="hidden" name="sometext"
value="<?php echo $thetext ?>" >
</form>
</html>
my php is in linux server and im running it from windows
if the original sender is unknown then this mail() could create blunders.
is there any way with which the person who received the mail will find the identity or mail id or ip-address of the original sender.
if i dont type any thing in from id then the mail is sent and the at the receivers side the from id is "Apache" what does it mean