-1

I want to send my data form that user type to a specific email. Example:

<form>
 <input type="text" placeholder="Your name"/>
 <input type="email" placeholder="Your email"/>
 <textarea name="content"></textarea>
 <input type="button" onclick="sendmail()"/>
</form>

When user clicks the button, an email will be sent to a specific address like admin@admin.com with email's content is what user type in the form. Can we reach that result with only JavaScript or jQuery?

Raphaël VO
  • 2,413
  • 4
  • 19
  • 32

3 Answers3

0

You can't do it without additional modules :

This is a good tutorial , you could create a dedicated address reported@yoursite.com and have it email your admin address when a user registers

c0d3junk13
  • 1,162
  • 9
  • 6
0
<a id="emailLnk" >send mail</a>

<script type="text/javascript">
$(document).ready(function() {

$("#emailLnk").click(function(){
     document.location.href = "mailto:xyz@something.com";
 });
});​
</script>
Sora
  • 2,465
  • 18
  • 73
  • 146
0

No, unless someone took the time to rewrite a SMTP client or sendmail in JavaScript, which is not the case. Moreover, that would mean giving away the SMTP password (which is bad) or not using a SMTP at all, meaning that almost all free/commercial providers will reject your e-mail.

You should set up a minimal PHP script to receive a POST request and forward the body as e-mail to your designed account. You should be able to do it in a handful of lines.

Stefano Sanfilippo
  • 32,265
  • 7
  • 79
  • 80