I wish to send an email with an attachment through gmail.
I'm using google-api-nodejs-client for node.js.
My current message sending code is:
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
}
});
Is there a way to add an attachment to the send function?
Your attachment should be in the "raw" base64EncodedEmail you're already using. The format is simply a full email message (e.g. look at "Show Original" in Gmail or any other mail client to see what an email with an attachment looks like). I imagine there are some MIME email message libraries that will be helpful...