Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: HTML
Is it possible to send Mail using javascript. If yes then kindly give me some hint.
Posted 17-Feb-11 2:41am
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
0 OriginalGriff 250
1 Jochen Arndt 155
2 PIEBALDconsult 150
3 DamithSL 125
4 Afzaal Ahmad Zeeshan 120
0 OriginalGriff 5,695
1 DamithSL 4,591
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 11 Jul 2013
Copyright © CodeProject, 1999-2014
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