How Do I Send The Data In A Html Form To An Email Address?
Friday, June 26th, 2009 at
5:24 am
How do i send the data in a html form to an email address?
Tagged with: Data • email • Form • HTML • Send
Filed under:
HTML
Like this post? Subscribe to my RSS feed and get loads more!
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…http://jotform.com/http://www.thesitewizard.com/http://www.thepcmanwebsite.com/form_mail…http://emailmeform.com/
HTHs,
Ron
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:
(replace
Your emailfwd.php file:
< ?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. "rn";
$subject = "Submitted application";
$msg = $name . " has sumitted a form!rn";
$msg .= "Pwd: " . $pwd . "rn";
$msg .= "email address: " . $email . "rn";
... ADD HERE THE REST OF THE DATA
mail($to, $subject, $msg, $headers);
echo ("Mail processed.");
?>
Code:
< ?
/***********************
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‘ . “rn” .
‘Reply-To: webmaster@example.com‘ . “rn” .
‘X-Mailer: PHP/’ . phpversion();
mail($to, $subject, $message, $headers);
***&&&&&*******
For HTML Mail
‘MIME-Version: 1.0′ . “rn”;
$headers .= ‘Content-type: text/html; charset=iso-8859-1′ . “rn”;
*/
function MyMail($To, $Subject, $Msg, $From, $ReplyTo){
$this->To=(empty($To)) ? “0″ : $To;
$this->Subject=(empty($Subject)) ? “0″ : $Subject;
$this->Msg=(empty($Msg)) ? “0″ : $Msg;
$this->From=(empty($From)) ? “0″ : $From;
$this->ReplyTo=(empty($ReplyTo)) ? “0″ : $ReplyTo;
$this->Headers=”MIME-Version: 1.0″ . “rn” . “Content-type: text/html; charset=iso-8859-1″ . “rn” . “From:” . $this->From . “rn” . “Reply-To:” . $this->ReplyTo . “rn” . “X-Mailer: PHP/” . phpversion();
//Use this array if you want to send to only one person
$SetMail=array(
‘To’=> $this->To,
‘Subject’=> $this->Subject,
‘Msg’=> $this->Msg,
‘Headers’=> $this->Headers,
‘From’=> $this->From,
‘ReplyTo’=> $this->ReplyTo
);
//Use this array if you want it to go to multiple people (the sender/CC:/Bcc:)
/*
$SetMail=array(
‘To’=> $this->To . “,” . $ToSender,
‘Subject’=> $this->Subject,
‘Msg’=> $this->Msg,
‘Headers’=> $this->Headers,
‘From’=> $this->From,
‘ReplyTo’=> $this->ReplyTo
);
*/
if(in_array(“0″,$SetMail)){
echo “
“;
return;
}
else{
if(!mail($SetMail['To'], $SetMail['Subject'], $SetMail['Msg'], $SetMail['Headers'])){
echo ““;
}
}
}
}
?>
$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”);
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.
this part is in bold”
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?
You may like to take an html tutorial at http://referencedesigner.com/tutorials/h...
couldn’t you just copy and paste the data into the body of the email?