Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

stuck in email (minor problem)

$
0
0

hey friends.. the script is sending email .. but the problem is email is not showing the name and the email id of the sender,, rather it showing the hosting provider name.. as it was sending email to not the sender.. hope i can clear my problem ..here is the code.

 

 <form action="feed1.php" method="post">
 <table width="100%">
<tr><td>Name</td><td><input type="text" name="name" /></td></tr>
<tr><td>E-mail Id</td> <td><input type="text" name="email" /></td></tr>
<tr><td>Subject</td><td><input type="text" name="subject"/></td></tr>
<tr><td>Message</td><td><textarea rows="10" cols="20" name="message"></textarea></td></tr>
<tr><td colspan="2"><input type="submit" value="Send mail" name="sub" /></td></tr>
</table>
</form>

 

feed1.php

<?php     
error_reporting(-1);
if (function_exists('mail'))
 {
extract($_POST);
if(!empty($name) && !empty($email) && !empty($subject) && !empty($message))
{
    if(filter_var($email, FILTER_VALIDATE_EMAIL))
    {
$to = "sehgal_jas@yahoo.com";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers.= "From: ".$name."<".$email.">";
// send message
if (mail($to, $subject, $message, $headers))
{
?>
<script type="text/javascript"> alert('Email Send')
     window.location='about.php'; </script>
<?php
}
else
{
?>
<script type="text/javascript"> alert('Sending Failed')
     window.location='about.php'; </script>
<?php
}
    }
else
{
?>
<script type="text/javascript"> alert('Enter valid Email id')
     window.location='about.php'; </script>
<?php
 }}
 else
 ?>
<script type="text/javascript"> alert('Enter all the fields')
     window.location='about.php'; </script>
<?php
 }
 else
{
?>
<script type="text/javascript"> alert('Mail function disabled.. Try again after sometime')
     window.location='about.php'; </script>
<?php

}
?>

 

Problem

The email is showing

 

From: xyz@host261.hostmonster.com (not the email id of the sender and not its name)..

 

any suggestions? you can check this form at http://www.poemquotejoke.com/about.php


Viewing all articles
Browse latest Browse all 13200

Trending Articles