Click here to Skip to main content
15,879,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to send email in HTML using javascript/ajax..No server side code

Actually i want to use gmail or yahoo api.. I searched but could not find..

},

Can anyone help me..
Posted
Comments
DamithSL 14-Jun-14 2:00am    

First of All you need to generate key for that you need to register in mandrill..

For this follow the below link:

XML
https://medium.com/@mariusc23/send-an-email-using-only-javascript-b53319616782


<html>
<head>
    <title></title>
    <style type="text/css">
        #btnsend
        {
            width: 125px;
        }
    </style>
</head>
<body>
    <table>
        <tr>
            <td>
                &nbsp;From:&nbsp;&nbsp;&nbsp;&nbsp; <input type="text" id="txtfrom" />
            </td>
        </tr>
        <tr>
        <td>
            Subject:&nbsp; <input type="text" id="txtsubject" />
            </td>

        </tr>
        <tr>
            <td>
                TO:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="text" id="txtto" />
            </td>
            <br /
        </tr>
        <tr>
            <td>
                <input type="button" id="btnsend" value="Submit" /><br />
            </td>
        </tr>
    </table>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $.ajax({
            type: "POST",
            url: "https://mandrillapp.com/api/1.0/messages/send.json",
            data: {
                'key': 'XXXXXXXXXXXXXXX',
                'message': {
                    'from_email': 'your mail id',
                    'to': [
          {
              'email': 'receiver mail id',
              'name': 'Name',
              'type': 'to'
          }
        ],
                    'autotext': 'true',
                    'subject': 'YOUR SUBJECT HERE!',
                    'html': 'Body'
                }
            }
        }).done(function (response) {
            console.log(response);
        });

    </script>
</body>
</html>
 
Share this answer
 
JavaScript is client based, so doesn't have the capabilities like C# on the server.
You have the only mailto feature, which you can use at client side using HTML. It opens the default mail client installed in the user's system.

Read Can JavaScript email a form?[^]
 
Share this answer
 
You can try like below
Using anchor [^]
Sending an Email Message to Gmail With JavaScript[^]
Hope this helps
 
Share this answer
 
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900