Jump to content

problem in receiving mail


Recommended Posts

Sender address is an input from the user.I am using example.com. If the user enters From address like one@example.com, I receive the mail and from address is one@example.com.At the same time, if I use some other dome name, one@asd.com, I receive the mail from webmaster@example.comThis is my problem. My dear friends, I hope you will reply for it.Thanks and regards,T.R.Parthasarathy//-------------------------------------------------------------------------------------------------<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head><body> <?php// mail function spamcheck($field) {//eregi() performs a case insensitive regular expression match if(eregi("to:",$field) || eregi("cc:",$field)) return TRUE; else return FALSE; }$error="";if(isset($_POST[s1])){ $tfname = $_REQUEST['txtfname']; $tlname = $_REQUEST['txtlname']; $temail = $_REQUEST['txtemail']; $tptit = $_REQUEST['txtptit']; $tqual = $_REQUEST['selcou']; $tpdes = $_REQUEST['txtapdes']; $tadd = $_REQUEST['txtadd']; $tphone = $_REQUEST['txtpho']; // First Name if (!eregi("^[(0-9a-z_)]+[(0-9a-z)]$", $tfname)) { $error .= "First Name "; } // Last Name if (!eregi("^[(0-9a-z_)]+[(0-9a-z)]$", $tlname)) { $error .= "Last Name "; }/* // Qualification if (!eregi("^[0-9a-z_]+[0-9a-z]$", $tlname)) { $error .= "Qualification "; }*//* White space \s* matches 0 or more spaces \s+ matches 1 or more spaces*/ // Email if (!eregi("^[a-z]+[ _\.0-9a-z_]+[0-9a-z]+@([0-9a-z][0-9a-z._]+\.)+[a-z]{2,4}$", $temail)) { $error .="Email Address "; } // Project Title if (!eregi("^[(0-9a-z_)\s*]+[(0-9a-z)]$", $tptit)) { $error .= "Project Title "; }/* // Project Desecription if (!eregi("^[0-9a-z]$", $tpdes)) { $error .= "Project Description "; } // Address if (!eregi("^[0-9a-z]$", $tadd)) { $error .= "Address "; }*//* // Phone if (!eregi("^[0-9]$", $tphone)) { $error .= "Phone Number "; }*/ if ($error == "") {// check zip or rar file type if (($_FILES["file"]["type"] == "application/x-zip-compressed") || ($_FILES["file"]["type"] == "application/octet-stream")) { if ($_FILES["file"]["error"] > 0) { $error .= "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { $pro='/x1x2x1x2/'; $uploadDir = $pro; if($_POST) { $fileName = $_FILES['file']['name']; $tmpName = $_FILES['file']['tmp_name']; $fileSize = $_FILES['file']['size']; $fileType = $_FILES['file']['type']; $filePath = $uploadDir . $fileName; echo ($filePath); // get the file extension first $ext = substr(strrchr($fileName, "."), 1); // echo ("<br>" . $ext); // make the random file name $randName = md5(rand() * time());// echo ("<br>" . $randName . "<br>"); $imag=$randName.'.' . $ext;// echo ($imag); // and now we have the unique file name for the upload file $filePath = $uploadDir . $randName . '.' . $ext;// echo ("<br>File Path : ".$filePath."<br>"); $result = move_uploaded_file($tmpName, $filePath); chmod($filePath,0777);// echo ("uploaded successfully <a href=".$filePath.">".$filePath."</a>"); } } }//if "email" is filled out, send email if (isset($_REQUEST['txtemail'])) { //check if the email address is invalid $mailcheck = spamcheck($_REQUEST['txtemail']); if ($mailcheck==TRUE) { echo "Invalid input"; } else { //send email $fname = $_REQUEST['txtfname']; $lname = $_REQUEST['txtlname']; $quali = $_REQUEST['selcou']; $email = $_REQUEST['txtemail']; $subject = $_REQUEST['txtptit'] ; $pdes = $_REQUEST['txtapdes']; $files = $_REQUEST['file']; $add = $_REQUEST['txtadd']; $pho = $_REQUEST['txtpho']; $filename = $_FILES[file]['name']; $headers = 'From: ' .$email ."\r\n"; $headers = 'MIME-Version: 1.0' . "\r \n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n" . phpversion(); //mail($to, $subject, $message, $headers); $message = '<html><body><table border=1 align=center width=700><tr><td><table border=0 align=center width=100%> <tr><td colspan=2 bgcolor=#003399 align=center><font name=arial color=white size=20pt align=center>'.$subject.'</font></td></tr> <tr><td>Name </td><td>'.$fname . ' '. $lname .'</td></tr> <tr><td>Email</td><td>'.$email.'</td></tr> <tr><td>Numbers </td><td>'.$quali.'</td></tr> <tr><td>Description</td><td>'.$pdes.'</td></tr> <tr><td>Attachment </td><td><a href=// http://www.example.com'.$filePath...></tr> <tr><td>Address</td><td>'.$add. '<br> Phone : '.$pho.'</td></tr> <tr><td colspan=2> <a href="login.php">Login</a> </td></tr> </table></td></tr></table></body></html>'; // $message = htmlentities($message1, ENT_COMPAT, 'ISO-8859-1'); mail("example@example.com", $subject, $message, $headers);// echo "<br>Thank you for using our mail form";// header("location:index.html");// exit(); } } } else { $error .= "Invalid "; }}?><form method='post' action='cmail.php' enctype='multipart/form-data'> <table width="450" border="0" align="center" cellpadding="2" cellspacing="2" bgcolor="#FFFFFF" valign="top"> <tr> <td align='left' valign='top' class='lblclr'><span class='style19'>FName </span></td> <td align="left" valign="top"><div align="left"> <input name='txtfname' type='text' class='txtclr' id='txtfname' size='30' maxlength='50' value="<?=$_REQUEST['txtfname']?>" /> </div></td> </tr> <tr> <td align='left' valign='top' class='lblclr'><span class='style19'>LName </span></td> <td align="left" valign="top"><div align="left"> <input name='txtlname' type='text' class='txtclr' id='txtlname' size='30' maxlength='50' value="<?=$_REQUEST['txtlname']?>" /> </div></td> </tr> <tr> <td align='left' valign='top' class='lblclr'><span class='style19'>Numbers </span></td> <td align="left" valign="top"><div align="left"><span class='style11'> <select name="selcou" class='txtclr'> <option selected="selected"> <?=$_REQUEST['selcou']?> </option> <!-- <option selected=selected>Courses</option> --> <option selected="selected">One</option> <option>Two</option> <option>Three</option> </select> </span></div></td> </tr> <tr> <td align='left' valign='top' class='lblclr'><span class='style19'>Email </span></td> <td align="left" valign="top"><div align="left"> <input name='txtemail' type='text' class='txtclr' id='txtemail' size='30' maxlength='50' value="<?=$_REQUEST['txtemail']?>" /> </div></td> </tr> <tr> <td align='left' valign='top' class='lblclr'><span class='style19'>Text </span></td> <td align="left" valign="top"><div align="left"> <input name='txtptit' type='text' class='txtclr' id='txtptit' size='30' maxlength='100' value="<?=$_REQUEST['txtptit']?>" /> </div></td> </tr> <tr> <td align='left' valign="top" class='lblclr'><span class='style19'>Description </span></td> <td align="left" valign="top"><div align="left"><span class='style11'> <textarea name='txtapdes' cols='35' rows='5' class='txtclr'><?=$_REQUEST['txtapdes']?> </textarea> </span></div></td> </tr> <tr> <td align='left' valign='top' class='lblclr'><span class='style19'>Upload file and < 2 MB </span></td> <td align="left" valign="top"><div align="left"> <input name='file' type='file' class='txtclr' id='file' size='30' /> </div></td> </tr> <tr> <td align='left' valign='top' class='lblclr'><span class='style19'>Address </span></td> <td align="left" valign="top"><div align="left"> <input name='txtadd' type='text' class='txtclr' id='txtadd' size='30' maxlength='150' value="<?=$_REQUEST['txtadd']?>" /> </div></td> </tr> <tr> <td align='left' valign='top' class='lblclr'><span class='style19'>Phone </span></td> <td align="left" valign="top"><div align="left"> <input name='txtpho' type='text' class='txtclr' id='txtpho' size='30' maxlength='10' value="<?=$_REQUEST['txtpho']?>" /> </div></td> </tr> <tr> <td colspan="2"><div align='center'><span class='style1'> <?=$error?> </span></div></td> </tr> <tr> <td align="center"> </td> <td align="center"><div align='left'><span class='style11'> <input name='s1' type='submit' class='heading' value='Submit Form'/> <input name="r1" type="reset" class="heading" id="r1" value="Clear Form" /> </span></div></td> </tr> </table> </form></body></html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...