title: How to send a mail with an attachment in gmail api using google-api-nodejs-client for nodejs
body: <p>I wish to send an email with an attachment through gmail.</p>
  
  <p>I'm using google-api-nodejs-client for node.js.</p>
  
  <p>My current message sending code is:</p>
  
  <pre><code>var gmailClass = google.gmail('v1');
  gmailClass.users.messages.send({
              auth: OAuth2Client,
              userId: 'me',
              resource: {
                raw: base64EncodedEmail
              },
            }
          ,function(err, results)
          {
          if (!err)
          {
            //do something    
          }
          else
          {
            //do something
          }
  });
  </code></pre>
  
  <p>Is there a way to add an attachment to the send function?</p>