How to send email using javaScript - ASP TANMOY

Latest

Wednesday 12 August 2015

How to send email using javaScript

Step 1: Register and collect mandrillapp API KEY.

Step 2: copy the following code and edit if with your valid email id and and API Key

Code :



<script>
function sendMail() {
    $.ajax({
      type: 'POST',
      url: 'https://mandrillapp.com/api/1.0/messages/send.json',
      data: {
        'key': 'Your API Key from MandrillApp',
        'message': {
          'from_email': 'your email id',
          'to': [
              {
                'email': 'enter email id where you want to send email',
                'name': 'Recipient Name',
                'type': 'to'
              }
            ],
          'autotext': 'true',
          'subject': 'Your Email Subject',
          'html': 'your email body message'
        }
      }
     }).done(function(response) {
       console.log(response);
     });
}
</script>

No comments:

Post a Comment