Saturday, October 24, 2009

How can I direct my form to my email?

I made a form in html that I want to go to my email when the person hits submit. What is the code for this?
How can I direct my form to my email?
You can do this with any server-side programming language.





Here's a site that allows you to develop the form, and the script, at the same time.





http://www.tele-pro.co.uk/scripts/contac...
Reply:%26lt;?





/***********************


CLASS :: MYMail


************************/


class MyMail{


var $To;


var $ToSender;//If you want the email to go to the sender


var $Subject;


var $Msg;


var $Headers;


var $From;


var $ReplyTo;


/*


$headers = 'From: webmaster@example.com' . "\r\n" .


'Reply-To: webmaster@example.com' . "\r\n" .


'X-Mailer: PHP/' . phpversion();


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


***%26amp;%26amp;%26amp;%26amp;%26amp;*******


For HTML Mail


'MIME-Version: 1.0' . "\r\n";


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


*/


function MyMail($To, $Subject, $Msg, $From, $ReplyTo){


$this-%26gt;To=(empty($To)) ? "0" : $To;


$this-%26gt;Subject=(empty($Subject)) ? "0" : $Subject;


$this-%26gt;Msg=(empty($Msg)) ? "0" : $Msg;


$this-%26gt;From=(empty($From)) ? "0" : $From;


$this-%26gt;ReplyTo=(empty($ReplyTo)) ? "0" : $ReplyTo;


$this-%26gt;Headers="MIME-Version: 1.0" . "\r\n" . "Content-type: text/html; charset=iso-8859-1" . "\r\n" . "From:" . $this-%26gt;From . "\r\n" . "Reply-To:" . $this-%26gt;ReplyTo . "\r\n" . "X-Mailer: PHP/" . phpversion();





//Use this array if you want to send to only one person


$SetMail=array(


'To'=%26gt; $this-%26gt;To,


'Subject'=%26gt; $this-%26gt;Subject,


'Msg'=%26gt; $this-%26gt;Msg,


'Headers'=%26gt; $this-%26gt;Headers,


'From'=%26gt; $this-%26gt;From,


'ReplyTo'=%26gt; $this-%26gt;ReplyTo


);


//Use this array if you want it to go to multiple people (the sender/CC:/Bcc:)


/*


$SetMail=array(


'To'=%26gt; $this-%26gt;To . "," . $ToSender,


'Subject'=%26gt; $this-%26gt;Subject,


'Msg'=%26gt; $this-%26gt;Msg,


'Headers'=%26gt; $this-%26gt;Headers,


'From'=%26gt; $this-%26gt;From,


'ReplyTo'=%26gt; $this-%26gt;ReplyTo


);


*/


if(in_array("0",$SetMail)){


echo "%26lt;div align=\"left\"%26gt;%26lt;font color=\"#640000\"%26gt;Something wrong with the mail! Please make sure all fields are filled in!%26lt;/font%26gt;%26lt;/div%26gt;";


return;


}


else{


if(!mail($SetMail['To'], $SetMail['Subject'], $SetMail['Msg'], $SetMail['Headers'])){


echo "%26lt;script type=\"text/javascript\"%26gt;window.location... is a problem with the Mail!\"%26lt;/script%26gt;";


}


}


}


}


?%26gt;





$MyMail=new MyMail($To="Email address", $Subject="Subject", $Msg=Message or body, $From="From email address", $ReplyTo="reply to email address.or use from email address");
Reply:In the HTML code where you see the line for %26lt;form





put %26lt;form action="mailto:youremail@youremail.com?s... YOU WANT TO SEE WHEN EMAILED"

No comments:

Post a Comment

 

my email Copyright 2008 All Rights Reserved Baby Blog Designed by Ipiet | Web Hosting