Possible Duplicate:
Need to Send Email from HTML pages
Is there a way to use a form to send an email with no database? Is there an html element that can do this?
Possible Duplicate:
Need to Send Email from HTML pages
Is there a way to use a form to send an email with no database? Is there an html element that can do this?
You could use an email link:
<a href="mailto:person@domain.tld">Person</a>
Edit: If you really want to use a form, you could take advantage of the mailto
parameters such as subject, body, cc, and bcc to customize your email. Here is an example:
// JS
// Uses jQuery but could be done without
$(function() {
$('div').click(function() {
var emailLink = $('#email');
emailLink.attr('href', 'mailto:person@domain.com?subject=' + $('#subject').val() + '&body=' + $('#body').val());
})
});
/* CSS */
div {
cursor: pointer;
color: blue;
text-decoration: underline;
}
<!-- HTML -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Subject: <input type="text" id="subject"><br>
Body: <input type="text" id="body"><br>
<div>Update Email Settings</div>
<a id="email" href="mailto:person@domain.com">
Send Email
</a>
Note that this would still use the user's default email client and will not send the email on its own. However, it allows you to change the subject and content of the email from your form and pass it to the email client.
<a href="mailto:name@company.com">someOne</a>
It will open a Email Client software, like MS-Outlook. If you want to send it directly with HTML & JS, it's impossible.
Cos, the mail need SMTP-protocol to send the mail, but the browser only support HTTP-protocol. you need a SMTP server to send mail and also with some server side code,like php or jsp...
If you mean you want to send the email dynamically, will need more than HTML and JavaScript like PHP or ASP.net.
You can use a hyperlink to make user to click on then redirect user to the default mailing system. For example, you can use
<a href="mailto:user@gmail.com">Username</a>