Page 1 of 1

Problem - PHP-sending data to my mail id

Posted: Mon Sep 06, 2010 8:05 am
by vjn_23
Hi Friends,

I did one contact.php and process.php(also i attached txt file). This process.php file send the data to my yahoo mail id.

But i didnt receive any mails from this page. I dont know what i did the mistaken.

so pls kindly send me you suggestion or feedback. waiting for your valuable suggestion.

contact.php

Code: Select all

<!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=utf-8" />
<title>testing - Contact Page</title>
</head>

<body>
<form name="contact" method="POST" action="process.php">
<table width="456" border="0" cellpadding="0" cellspacing="0">
   <tr>
      <td height="28" valign="top">Your name:</td>
      <td><input name="name" type="text"></td>
   </tr>
   <tr>
      <td height="28" valign="top">E-mail address:</td>
      <td><input name="email" type="text"></td>
   </tr>
   <tr>
      <td height="28" valign="top">Contact No:</td>
      <td><input name="contact" type="text"></td>
   </tr>
   <tr>
      <td height="28" valign="top">Message:</td>
      <td><input name="message" type="text" /></td>
   </tr>
   <tr>
      <td>&nbsp;</td>
      <td valign="top" align="center"><input type="submit" value="Submit" name="submit"></td>
   </tr>
</table>
</form>
</body>
</html>


process.php

Code: Select all

<?php
if(isset($_POST['submit'])) {
   $to = 'vjn_23@yahoo.co.in';     //put your email address on which you want to receive the information
   $subject = 'hello';   //set the subject of email.
   
   $headers = 'MIME-Version: 1.0' . "\r\n".
			'Content-type: text/html; charset=utf-8' . "\r\n".
			'From: vijay@telltales.in' . "\r\n" .
			'Reply-To: vijay@telltales.in' . "\r\n" .
			'X-Mailer: PHP/' . phpversion();
   
   $message = "<table><tr><td>Your Name</td><td>".$_POST['name']."</td></tr>
               <tr><td>E-Mail</td><td>".$_POST['email']."</td></tr>
               <tr><td>Contact No</td><td>".$_POST['contact']."</td></tr>
               <tr><td>Message</td><td>".$_POST['message']."</td>
               </tr></table>" ;
			   
   mail($to, $subject, $message, $headers);
   header('Location: contact.php');
}
?>



Thank U,
Vjn_23

Re: Problem - PHP-sending data to my mail id

Posted: Mon Sep 06, 2010 2:18 pm
by buckit
is there a SMTP server specified in your PHP.ini file? you cant send email without a SMTP server to relay it for you.