View Single Post
Old 08-11-2006, 12:16 AM   #2
danielbruzual
Member Level 2
 
danielbruzual's Avatar
 
Join Date: May 2006
Posts: 22
My Photos: ()
iTrader: (0)

Banked:
MK Cash: $0.00

I am Worth:
MK Cash: $0.00
Donate

Recent Blog: None

danielbruzual is on a distinguished road
Default

I'll be first in this thread by posting a really simple php mail snippet I coded. It is really simple since it does not validate the email address or check if any of the fields is empty.
Code:
<? $emailaddress = "youremail@address.com"; If(isset($_POST['submit'])){ $from = $_POST['name']; $email = $_POST['email']; $msg = 'From: '.$from.' <'.$email.'>'.$eol; $msg .= "\t\n"; $msg .= "Sent on: ".date("Y/m/d H:i:s"); $msg .= "\t\n\t\n"; $msg .= $_POST['message']; $eol="\n"; $emailsubject="Here's An Email From Your Site-".date("Y/m/d H:i:s"); $headers = 'From: '.$from.' <'.$email.'>'.$eol; $headers .= 'Reply-To: '.$from.' <'.$email.'>'.$eol; $headers .= 'Return-Path: '.$from.' <'.$email.'>'.$eol; // these two to set reply address $headers .= "Message-ID: < TheSystem@".$_SERVER['SERVER_NAME'].">".$eol; $headers .= "X-Mailer: PHP v".phpversion().$eol; // These two to help avoid spam filters $sendmail = mail($emailaddress, $emailsubject, $msg, $headers); If($sendmail){ echo "<br /><p style=\"font-family: trebuchet ms, sans serif\">Message sent successfully.</p>"; } else { echo "<br /><p style=\"font-family: trebuchet ms, sans serif\">Message could not be sent. Please try again later.</p>"; } } If(!isset($_POST['submit'])){ ?> <h2>Contact Us</h2> <table><form method="post" action=""> <tr><td>Your name:</td><td><input type="text" name="name" size="50"/></td></tr> <tr><td>Your email:</td><td><input type="text" name="email" size="50"/></td></tr> <tr><td>Message:</td><td><textarea name="message" rows="3" cols="49"></textarea></td></tr> <tr><td></td><td><input type="submit" name="submit" /></form></td></tr> </table> <? } ?>
__________________
Free PHP Website Hosting - WARNING: Might be too much for you.
danielbruzual is offline   Reply With Quote