<?php
$recipient = "youremailaddress@aol.com";
$subject = "This is an email test";
$sender = "whosenttheemail@aol.com";
$content="This is a test to see if you can send an email to anyone.";
$message = "
This is an email test
--------------------------------------------------
Email from: $sender
$content
---------------------------------------------------
";
$extraheaders = "From: $sender\nReply-To: $sender\n\n";
if (! mail($recipient, $subject, $message, $extraheaders))
echo "Mail did not send for some reason.";
echo "Email Sent";
?>
<?php
$recipient = $_POST["recipient"];
$subject = "This is an email test";
$sender = "salmon@electric-heart.com";
$field1 = $_POST["field1"];
$content="This is a test to see if you can send an email to anyone.";
$message = "
This is an email test 2 $field1
--------------------------------------------------
Email from: $sender
$content
---------------------------------------------------
";
$extraheaders = "From: $sender\nReply-To: $sender\n\n";
if (! mail($recipient, $subject, $message, $extraheaders))
echo "Mail did not send for some reason.";
echo "Email Sent";
?>
<!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>Untitled Document</title> </head> <body> <form action="mail.php" method="POST" name="contact" id="contact"> e-mail: <input type="test" name="recipient" value=""><br/> first field: <input name="field1" type="text"><br/> <input name="Submit" type="submit" value="Submit"></td> </form> </body> </html>
<?php
// recipient
$recipient = $_POST["recipient"];
// subject
$subject = "This is an email test";
$sender = "salmon@electric-heart.com";
$field1 = $_POST["field1"];
$content="This is a test to see if you can send an email to anyone.";
// message
$message = "
<html>
<head>
</head>
</body>
</html>
";
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
$extraheaders = "From: $sender\nReply-To: $sender\n\n";
if (! mail($recipient, $subject, $message, $headers))
echo "Mail did not send for some reason.";
echo "Email Sent";
?>
<html>
<body>
<br />First field: <?php echo $_POST["field1"]; ?>
</body>
</html>
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Introducing QiPHP Framework - FINALLY... a Ruby on Rails Killer for PHP!!! | smoseley | PHP | 32 | October 15 '09 12:08 AM |
| PHP Mail Form | Mekhet | PHP | 4 | June 10 '08 03:55 AM |
| mail () form - Customizing for my needs, help! | vero | PHP | 10 | December 6 '07 06:27 PM |
| My mail form causes "Page has Expired" in IE | TheGardener | PHP | 2 | March 24 '07 04:04 PM |
| Mail Form Input Type = Fax? | Franco50 | General Design Discussion | 1 | October 19 '04 01:26 PM |