gmail-api

Most efficient way to get new messages

允我心安 提交于 2019-12-03 14:35:37
I have a process that looks for new messages in a users Gmail. The message is added to an external database if it meets certain address criteria. We have been using Users.History.List which returns all messages that have had a change made to them. This is quite inefficient as we have to subsequently check each message to see if we have already processed it. We are looking at alternatively using Users.Messages.List and checking the MsgId to see if it is larger than the previous check (we store the Id from that). The assumption here is that the MsgId will keep getting larger. Is this approach

Remove an attachment of a Gmail email with Google Apps Script

99封情书 提交于 2019-12-03 14:06:58
Using Google Apps Script ( http://script.google.com ), I know from the docs , how to send, forward, move to trash messages, etc. but I don't find how to remove a file attachement of an email , i.e.: keep the text content (either in HTML or just plain text would be fine) keep the original sender, keep the recipient keep the original message date/hour (important!) remove the attachment If it's not possible via the API, is there a way to resend the message to myself, while keeping 1, 2 and 3? Note: the GmailAttachment class looks interesting and allows to list recipients: var threads = GmailApp

Gmail API decoding messages in Javascript

一曲冷凌霜 提交于 2019-12-03 12:49:29
问题 I am having serious problems decoding the message body of the emails I get using the Gmail API. I want to grab the message content and put the content in a div. I am using a base64 decoder, which I know won't decode emails encoded differently, but I am not sure how to check an email to decide which decoder to use -- emails that say they are utf-8 encoded are successfully decoded by the base64 decoder, but not be a utf-8 decoder. I've been researching email decoding for several days now, and I

How do I use oauth2 and refresh tokens with the google api?

Deadly 提交于 2019-12-03 12:47:43
问题 So I just spent the last few days trying to figure this out and am asking this question so that I can answer it for other people who are having problems. First, the google documentation is TERRIBLE and uses different oauth2 libraries depending on which of the many google API examples you are looking at. It is often self-contradictory and sometimes straight up has code in it that doesn't work. Oh well. so my questions were basically: how do I use the google api libraries to have my users grant

How to access the new Gmail API from my Android app?

倖福魔咒の 提交于 2019-12-03 10:43:06
问题 I am trying to access the new Gmail API (announced 25.06.2014) from my Android app in order to return all e-mail messages in a certain users's account. I am developing the app in Eclipse using the ADT plug-in. What I have done so far: I registered the application in the Google Developers Console (link: console.developers.google.com/project ). I have implemented the Google+ Sign-in button (link: developers.google.com/+/mobile/android/sign-in ). The Google+ Sign-In button authenticates the user

gmail api returning total messages as 0 for a particular Label

谁说胖子不能爱 提交于 2019-12-03 09:15:10
I have been using the "Get Label" API to get the details of a particular Label. It was all working until the last couple of days. What I now observe is that the "Total Messages" Count is always 0. "UnRead Messages" Count show up properly. I have used it in my application and also tried it from https://developers.google.com/gmail/api/v1/reference/users/labels/get - "Try It Now" and the result is the same --- 0 Total Messages As noted in the comments to the question, there's an apparent bug in the API as reported here . FWIW I'm running into the same issue. In my case I have three accounts, all

send mail using gmail api in android

醉酒当歌 提交于 2019-12-03 09:05:02
I am using the code example in the link (SendEmailCtrl.java) : https://developers.google.com/gmail/api/guides/sending My activity sends email with example, I add the library javax.mail:javax.mail-api:1.5.3 I did not find any more examples how to send mail using the gmail api SharedPreferences settings = getPreferences(Context.MODE_PRIVATE); credential = GoogleAccountCredential.usingOAuth2( getApplicationContext(), Arrays.asList(SCOPES)) .setBackOff(new ExponentialBackOff()) .setSelectedAccountName(settings.getString(PREF_ACCOUNT_NAME, null)); mService = new com.google.api.services.gmail.Gmail

Create a native filter in Gmail using Google Apps Script

坚强是说给别人听的谎言 提交于 2019-12-03 08:40:12
I want to make a filter that is native to gmail for certain set of parameters. Basically I use the google alias function a lot (the + sign after your email). I want to automate the process of creating a filter that reads the "To" line then looks for a "+". If the a "+" is found it will make a label of what is after the "+". Then it will create a dedicated/native filter that will: skip the inbox and apply the label of what is after the "+". I have looked through the gmail scripts and have not found a way to make a native filter. I understand that this functionality might have just been

How to tell if an email sent via Gmail REST API has bounced?

帅比萌擦擦* 提交于 2019-12-03 06:33:01
I'm sending emails via Gmail API and would like to know when the messages bounce. How can I do this? As I understand it, bounced emails usually contain some sort of header indicating a bounce such as: X-Failed-Recipients: zzzzzzzzzasdfasdfadfa@gmail.com However, there doesn't seem to always be a header indicating what original messageID it was that bounced. I was thinking of the following plan, but there are so many holes that I think I must be approaching this wrong. Send email (to a failed email) via Gmail API ---> It goes through successfully Receive the email bounced email inbox Scan email

Gmail API decoding messages in Javascript

爷,独闯天下 提交于 2019-12-03 03:57:46
I am having serious problems decoding the message body of the emails I get using the Gmail API. I want to grab the message content and put the content in a div. I am using a base64 decoder, which I know won't decode emails encoded differently, but I am not sure how to check an email to decide which decoder to use -- emails that say they are utf-8 encoded are successfully decoded by the base64 decoder, but not be a utf-8 decoder. I've been researching email decoding for several days now, and I've learned that I am a little out of my league here. I haven't done much work with coding around email