Click here to Skip to main content
13,000,017 members (46,280 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Is it possible to send Mail using javascript. If yes then kindly give me some hint.
Posted 17-Feb-11 1:41am
Updated 23-May-16 9:47am
Comments
Nitij 13-Jun-16 6:02am
   
You can't. Server needs to come into picture to provide authentication details.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

JavaScript is of course client based so doesn't have the capabilities as say C# on the server. To send email, without calling some server-side code, you are basically limited to mailto
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

You can see this here[^]. It uses Javascript but sends email using Outlook automation.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

NO! JavaScript can’t email a form! but, there are alternatives to send the form data to an email address.

See detail here:
http://www.javascript-coder.com/javascript-form/javascript-email-form.phtml[^]
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

You could create a web service that sends a mail...

[WebMethod]
public void SendEmail(string subject, string message)
{
     // Standard C# Send Mail stuff    
}


Then, you could call the web service from script to send the mail.

Have a look at jquery or other scripting frameworks which provide AJAX helper functionality for calling web service methods
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 5

<form method="post" action="">
    <input type="text" id="email" name="name" required>
    <input type="button" value="Send Email" onclick="send()/>
</form>



<script type="text/javascript">
  function send() {
    var link = 'mailto:email@example.com?subject=Message from '
             +document.getElementById('email').value
             +'&body='+document.getElementById('email').value;
    window.location.href = link;
}
</script>
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170624.1 | Last Updated 10 Jun 2016
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100