title: Uncaught TypeError: Cannot read property 'users' of undefined
body: <p>I am using Gmail API to Send Email. but getting an error:</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'users' of undefined</p>
  </blockquote>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
      function sendMessage(email, callback) {
          // Web-safe base64 
          var base64EncodedEmail = btoa(email).replace(/\//g, '_').replace(/\+/g, '-');
          var request = gapi.client.gmail.users.messages.send({
              'userId': 'me',
              'message': {
                  'raw': base64EncodedEmail
              }
          });
          request.execute(callback);
      }
  
      function send() {
  
  
          var to = 'vijay@itsabacus.com',
           subject = 'Hello World',
  
           content = 'send a Gmail.'
          var email = "From: 'me'\r\n" +
              "To:  " + to + "\r\n" +
              "Subject: " + subject + "\r\n" +
              "\r\n" +
              content;
              sendMessage(email, function () {
              console.log(arguments);
          });
      }
  &lt;/script&gt;
  </code></pre>