Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

forword mail

the mail() function

Moderators: macek, egami, gesf

forword mail

Postby gadesrikanthreddy » Thu Jan 05, 2012 12:33 am

hi friends,

i have webpage it contains contact information page...when i field those fields and click on submit i want get mail to my personal email like gmail,yahoo....hoe can i do it...is it possible ....please guide me .........thanks in advance......
gadesrikanthreddy
New php-forum User
New php-forum User
 
Posts: 1
Joined: Thu Jan 05, 2012 12:21 am

Re: forword mail

Postby rupali » Thu Jan 05, 2012 2:54 am

<html>
<head>
<title>Email </title>
</head>
<?php
if(isset($_POST['submit']))
{
$from = $_POST['from']; // Sender's email id
$to = $_POST['to']; // Receiver's email id
$subject = $_POST['subject'];
$txt= $_POST['message'];

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: '. $from . "\r\n";

mail($to,$subject,$txt,$headers);

echo "mail sent";
}
?>
<body>
<form method="post" action="">
<table cellpadding="10" cellspacing="10">
<tr>
<td>From </td>
<td><input type="text" name="from"></td>
</tr>
<tr>
<td>To </td>
<td><input type="text" name="to"></td>
</tr>
<tr>
<td>Subject </td>
<td><input type="text" name="subject"></td>
</tr>
<tr>
<td>Message</td>
<td><textarea cols="20" rows="5" name="message"></textarea></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Submit"></td>
</tr>
</table>
</form>
</body>
</html>


Note : Mail feature not execute on localhost machine.
rupali
New php-forum User
New php-forum User
 
Posts: 140
Joined: Thu Oct 13, 2011 10:32 pm
Location: Chandigarh, INDIA


Return to PHP coding => Mail

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.