Click here to Skip to main content
15,074,987 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..
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:


    <style type="text/css">
            width: 125px;
                &nbsp;From:&nbsp;&nbsp;&nbsp;&nbsp; <input type="text" id="txtfrom" />
            Subject:&nbsp; <input type="text" id="txtsubject" />

                TO:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="text" id="txtto" />
            <br /
                <input type="button" id="btnsend" value="Submit" /><br />
    <script src="//" type="text/javascript"></script>
    <script type="text/javascript">
            type: "POST",
            url: "",
            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) {

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?[^]
You can try like below
Using anchor [^]
Sending an Email Message to Gmail With JavaScript[^]
Hope this helps

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