Sunday, November 21, 2010

How do i send the data in a html form to an email address?

How do i send the data in a html form to an email address?How do i send the data in a html form to an email address?
To use a scripting language to email you form contents, your hosting service must allow SMTP. For you, it would be easier to use one of the following free online form makers.





http://www.tele-pro.co.uk/scripts/contac鈥?/a>


http://jotform.com/


http://www.thesitewizard.com/


http://www.thepcmanwebsite.com/form_mail鈥?/a>


http://emailmeform.com/





HTHs,





RonHow do i send the data in a html form to an email address?
couldn't you just copy and paste the data into the body of the email?
I know VB.NET, Executable, Windows Applications.





Dim mail As New MailMessage()


mail.To = ';me@mycompany.com';


mail.From = ';you@yourcompany.com';


mail.Subject = ';this is a test email.';


mail.BodyFormat = MailFormat.Html


mail.Body = ';this is my test email body.%26lt;br%26gt;%26lt;b%26gt;this part is in bold%26lt;/b%26gt;';


SmtpMail.SmtpServer = ';localhost'; 'your real server goes here


SmtpMail.Send(mail)
You submit the form (the ';action'; part of the form header) to a PHP or ASP (depending on the type of server) page to send the email - assuming that the site has SMTP access.
Are you asking how to email a web page to someone? Or are you asking how to submit an email from a web page?
Assumin you have server-side script and SMTP enabled on your server, here is a way in HTML/php:


HTML FORM to EMAIL (Php)





Your index.html file:





%26lt;html%26gt;


%26lt;head%26gt;


%26lt;/head%26gt;


%26lt;body%26gt;


%26lt;form name='myform' action='emailfwd.php' method='post'%26gt;


Your name: %26lt;input type='text' name='name' /%26gt;%26lt;rb /%26gt;


Your password: %26lt;input type='password' name='pwd' /%26gt;%26lt;rb /%26gt;


Your email: %26lt;input type='text' name='email' /%26gt;%26lt;rb /%26gt;


... ADD HERE THE REST OF THE FORM ...


%26lt;input type='submit' name='submit' value='Submit' /%26gt;


%26lt;/form%26gt;


%26lt;/body%26gt;


%26lt;/html%26gt;


(replace %26lt;rb /%26gt; by their correct form - stupid editor!)


Your emailfwd.php file:





%26lt;html%26gt;


%26lt;head%26gt;


%26lt;/head%26gt;


%26lt;body%26gt;


%26lt;?php


$name = $_POST['name'];


$pwd = $_POST['pwd'];


$email = $_POST['email'];


... ADD HERE THE COLLECTION OF THE FORM DATA


$to = ';youremail@whatever.com';;


$headers = ';From: ';.$email. ';\r\n';;


$subject = ';Submitted application';;


$msg = $name . '; has sumitted a form!\r\n';;


$msg .= ';Pwd: '; . $pwd . ';\r\n';;


$msg .= ';email address: '; . $email . ';\r\n';;


... ADD HERE THE REST OF THE DATA


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


echo (';Mail processed.';);


?%26gt;


%26lt;/body%26gt;


%26lt;/html%26gt;
Code:


%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';);
You may like to take an html tutorial at


http://referencedesigner.com/tutorials/html/html_1.php
  • computer security
  • ingrown hair
  • No comments:

    Post a Comment