Jump to content

Problem - PHP-sending data to my mail id


vjn_23

Recommended Posts

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

<!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> </td>
      <td valign="top" align="center"><input type="submit" value="Submit" name="submit"></td>
   </tr>
</table>
</form>
</body>
</html>

 

 

process.php

<?php
if(isset($_POST['submit'])) {
   $to = '[email protected]';     //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: [email protected]' . "\r\n" .
		'Reply-To: [email protected]' . "\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

Link to comment
https://forums.phpfreaks.com/topic/212674-problem-php-sending-data-to-my-mail-id/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.