Gmail API

I’m currently using Sendgrid successfully, but the pricing is high for the low volume I expect.
Can somebody help me with the below Gmail API? which part is the client, which is *.jsw and which is *.js?
Which Import libraries are required and each module.


var CLIENT_ID = '853643010367revnu8a5t7klsvsc5us50bgml5s99s4d.apps.googleusercontent.com';
var SCOPES = ['https://mail.google.com/', 'https://www.googleapis.com/auth/gmail.send', 'https://www.googleapis.com/auth/gmail.modify', 'https://www.googleapis.com/auth/gmail.labels'];

function handleAuthResult(authResult) {
    if (authResult && !authResult.error) {
        loadGmailApi();
    }
}

$scope.initializeGMailInterface = function() {
    gapi.auth.authorize({
        client_id: CLIENT_ID,
        scope: SCOPES,
        immediate: true
    }, handleAuthResult);
};

function loadGmailApi() {
    gapi.client.load('gmail', 'v1', function() {
        console.log("Loaded GMail API");
    });
}

$scope.sendEmail = function() {
    var content     = 'HELLO';
    // I have an email account on GMail.  Lets call it 'theSenderEmail@gmail.com'
    var sender      = 'theSenderEmail@gmail.com';
    // And an email account on Hotmail.  Lets call it 'theReceiverEmail@gmail.com'\
    // Note: I tried several 'receiver' email accounts, including one on GMail.  None received the email.
    var receiver    = 'theReceiverEmail@hotmail.com';
    var to          = 'To: '   +receiver;
    var from        = 'From: ' +sender;
    var subject     = 'Subject: ' +'HELLO TEST';
    var contentType = 'Content-Type: text/plain; charset=utf-8';
    var mime        = 'MIME-Version: 1.0';

    var message = "";
    message +=   to             +"\r\n";
    message +=   from           +"\r\n";
    message +=   subject        +"\r\n";
    message +=   contentType    +"\r\n";
    message +=   mime           +"\r\n";
    message +=    "\r\n"        + content;

    sendMessage(message, receiver, sender);
};

function sendMessage(message, receiver, sender) {
    var headers = getClientRequestHeaders();
    var path = "gmail/v1/users/me/messages?key=" + CLIENT_ID;
    var base64EncodedEmail = btoa(message).replace(/\+/g, '-').replace(/\//g, '_');
    gapi.client.request({
        path: path,
        method: "POST",
        headers: headers,
        body: {
            'raw': base64EncodedEmail
        }
    }).then(function (response) {

    });
}

var t = null;
function getClientRequestHeaders() {
    if(!t) t = gapi.auth.getToken();
    gapi.auth.setToken({token: t['access_token']});
    var a = "Bearer " + t["access_token"];
    return {
        "Authorization": a,
        "X-JavaScript-User-Agent": "Google APIs Explorer"
    };
}

This is GAPI-code. I have a slight inkling that nobody is going to help you with this. Best I can do for you is using gmail thru emailjs (free for moderate use) as I described here: https://girizano.wixsite.com/codecorner/home/send-email-thru-gmail-and-others-in-wix-code