gmail-api

Getting history events for just new messages?

£可爱£侵袭症+ 提交于 2019-12-11 03:34:00
问题 I'd like to monitor a users gmail account for new messages and take an appropriate action. Is there a way to fetch the history events for just new messages but NOT for things like starring an email or changing its labels, etc.? 回答1: So I ended up using messages.list and storing the timestamp of the most recent message. Then on subsequent calls to messages.list I'd supply a query of "after:theMostRecentTimestampIKnowOf" to find new messages since the last time we synced. 回答2: Another route I

How to access gmail API?

倖福魔咒の 提交于 2019-12-11 03:30:02
问题 I generate my JWT, if my token is correct why dont work ? in Google Developers Console i enabled gmail plus youtube and other API, in credentials generate and download json { "private_key_id": "22dcf", "private_key": "-----BEGIN PRIVATE KEY-----(remove)-----END PRIVATE KEY-----\n", "client_email": "vgfjjc6@developer.gserviceaccount.com", "client_id": "jc6.apps.googleusercontent.com", "type": "service_account" } first generate token var sHead=JSON.stringify({"alg":"RS256","typ":"JWT"}); var

How to trigger Google Script when a Google Task is marked “completed”

帅比萌擦擦* 提交于 2019-12-11 03:22:31
问题 Google Apps Script allows scripts to be triggered by a variety of events; see here. I'd like to update the tag on an email (in Gmail) when the user marks a task completed (in Google Tasks) but there doesn't seem to be a trigger for this. However, Zapier is able to trigger on these events somehow: supported triggers So it seems like this trigger must exist. Is there a way to do this other than using Zapier? Unfortunately Zapier (in addition to costing money) only allows you to add tags to

java.lang.NoClassDefFound error javax Gmail API

和自甴很熟 提交于 2019-12-11 03:18:39
问题 I'm running into an exception in a gmail client I'm working on. The exception is the java.lang.NoClassDefFound that is triggered on the getDefaultInstance line Properties props = new Properties(); Session session = Session.getDefaultInstance(props, null); I've included the javax jar as follows: dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.google.android.gms:play-services:7.3.0' compile 'com.google.api-client

How to send a mail with an attachment in gmail api using google-api-nodejs-client for nodejs

时间秒杀一切 提交于 2019-12-11 02:59:45
问题 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? 回答1: Your attachment should be in the "raw" base64EncodedEmail you're

GMail API pagination use of nextPageToken

会有一股神秘感。 提交于 2019-12-11 02:37:15
问题 Have spent hours searching Google et. al. for an answer, sure it's simple but how do you create pagination with the GMail api using nextPageToken? what ever I do cannot get pagination to work (back and forth that is). Assume 'authorised user' and access with the right scopes I call gapi.client.load('gmail','v1',displayInbox); then function displayInbox(){ var request = gapi.client.gmail.users.messages.list({ 'userId':'me', 'maxResults':10, }); request.execute(function(response){ $.each

Google API (Gmail) failing with failed precondition 400

北城以北 提交于 2019-12-11 02:11:27
问题 I am trying to use the google APIs to read emails and I'm repeatedly failing to get good results. It is supposed to be a server->server account that runs periodically in the background, but I can't get it to connect. The code is basic: GoogleCredential credential; using (var stream = new FileStream("Content/service_credential.json", FileMode.Open, FileAccess.Read)) { credential = GoogleCredential.FromStream(stream); credential = credential.CreateScoped(new[] { GmailService.Scope.GmailModify }

Gmail Api resumable upload Rest( attachment larger than 5MB)

柔情痞子 提交于 2019-12-11 01:44:41
问题 I am trying to send via Gmail Api Rest a mail with attachment larger than 5MB. To accomplish that I am trying to sent it with resumable upload. This is my code. byte[] ba = System.IO.File.ReadAllBytes(uploadFromPath); String base64String = Convert.ToBase64String(ba); string url = "https://www.googleapis.com/upload/gmail/v1/users/me/messages/send?uploadType=resumable" HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest; request.Headers.Add("Authorization", "Bearer " + token);

Why the gmail API sends html emails as plain text?

醉酒当歌 提交于 2019-12-11 01:42:31
问题 I'm trying to send a html email using the gmail API but for some reasons it randomly sends the email as plain/text. It seems that Google alters the content type header I set. Is there any reason for that? The email content is exactly same all the time (as I test it). Is the API still experimental? Sometimes when it works it also adds Content-Type: multipart/alternative; (although I never set it). The encoding process looks as below. The code is Go but I guess it self explanatory and the

generic:3 - Push into an endpoint URL (pubsub api for gmail)

ぐ巨炮叔叔 提交于 2019-12-11 01:23:13
问题 I am working with pub/sub for the first time and its quite confusing. I just want to receive push notifications on my MVC application whenever I receive an email on gmail account. I have setup the project id (enabled pub/sub API), created a topic with permissions (gmail-api-push@system.gserviceaccount.com) and added a subscriber to that topic, everything from console.cloud.google.com as I don't think I need to setup these from my code everytime. I am trying to set the delivery type to 'Push