View Full Version : send email via html
09-09-2009, 08:36 AM
i'm making a contact form here,
How to get message from client / user and send it to my email address.
When user click send button the user email address and message will be send to my acount.
Thx for all of your help...
09-09-2009, 11:30 AM
You need to have a server side script (written in PHP for example).
The following tutorials might help:
Email Form 'HowTo's (http://www.html-form-guide.com/email-form/)
You can use a 'ready-made' form mail script (http://www.html-form-guide.com/form-mail/form-mail-script.html) as well.
09-09-2009, 01:44 PM
thx for reply. That really help..
But is there another suggestion?
What i really need is just the code that get the value from the textfield and textarea and send it directly to my email account.
09-09-2009, 02:39 PM
You definitely need to use a server side script like PHP.
These scripts can be very simple, I've posted examples of this in this forum before.
Here is a simple PHP script to create an email from data collected in a form:
$txtMessage = str_replace(array("\n","\r"),'',$txtMessage);
$txtEmail = str_replace(array("\n","\r"),'',$txtMail);
$Myemail="your email address here";
$message ="Message :\t$txtMessage\n
$subject = "Message from - ".$txtEmail;
$mailheaders = "From: $txtEmail <> \n";
$mailheaders .= "Reply-To: $txtEmail\n\n";
mail($Myemail, $subject, $message , $mailheaders);
The variables 'email' and 'message' are the names of input fields in your form.
Save the above PHP to a php file, eg process.php, and in your <form> tag you add, method="POST" action="process.php".
This is a simple example of creating an email, you can add more fields from the input form quite easily.
09-10-2009, 01:03 AM
hi, forum_amnesiac thx a lot for your help. I'll this at my contact form.
One last question:
but one's again thx for forum_amnesiac and prasanthmj:)
X96 Web Design
09-10-2009, 03:12 AM
Nope - JavScript won't work, it's Client-Side, you need Server-Side.
Most modern hosting providers support PHP, if they don't, then you should really consider switching to a better host....
09-10-2009, 03:27 AM
oow, ok thx. Just want extra information.:)
09-10-2009, 03:33 AM
There are also things called "Remotely Hosted Scripts" which is just what you were looking for in your original post and only require a little bit of code that you have to place in your HTML page. Do a Google search for "Remote Hosted Contact Form".
Hope this helps.
09-10-2009, 08:36 AM
thx for all the reply, i've change my mind and follow all of your suggestion, i will use the php script to handle this contact form.:)
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.