January 16th, 2013, 12:55 AM
How to make E-Mail sender in HTML ??
I want HTML code with which we can send E-Mail. I googled it and i got this code:
<a href="mailto:email@example.com">Your Text Here</a>
But I want a code with text boxes in which we can enter From address, To address and text which is e-mail body (comment).
Can anyone give me that code please ???
Thanks in advance!
January 16th, 2013, 08:56 AM
HTML is not capable of sending E-Mail. You need to combine it with a server side language like PHP, ASP.NET, Python, Ruby, etc.
January 17th, 2013, 05:33 PM
January 20th, 2013, 02:08 AM
Can u give me that php code please.....
Also code to attach php in HTML
January 20th, 2013, 08:45 AM
What you need to do is make a form for the user to fill out. This form should include the fields you want.
The important bit of this html is the action, method and the names of the fields
<form name="mail" action="send_mail.php" method="post">
<input type="text" name="name" />
<input type="text" name="email" />
<input type="text" name="comment" />
<input type="submit" value="Submit">
The php code as you saw on the link I gave you is
So what you need to do is, to take the names of the input fields and place them into that line of code. The file is in this example called send_mail.php
THIS IS JUST AN EXAMPLE for you to understand
$yourMail = "firstname.lastname@example.org"; //The email address you want to receive mails on
//stuff from the html form
$name = $_POST['name']; //Grap the name from the name field
$email = $_POST['email']; //Grap the email from the email field
$comment = $_POST['comment']; //Grap the comment from the comment field
//the magic part
mail($yourMail, $name, $email. $comment);
Now please notice that it would be a really bad idea to use this code, since it is vulnerable to injections. So you would want to do something in the lines off
January 21st, 2013, 04:50 AM
w3schools is not the best place to learn from, they tend to teach a lot of bad habits.
January 21st, 2013, 08:45 AM
True! Does it answer his question yes it does.
Originally Posted by sir_drinxalot
If you want to elaborate on escape methods, be my guest. Chances are high that he will get confused
January 23rd, 2013, 07:47 AM
Thanks for your code. It is nice
April 26th, 2013, 03:20 AM
You'll find a lot of help online on w3schools, quackit, php.net, stackoverflow, etc
I still recommend ASP.net because they have predefined functions that you would simply need to customize.