gmail-api

How to send big attachments with gmail API

陌路散爱 提交于 2019-11-29 18:09:15
i'm trying to send an email with Gmail API. I'm able to send it with smaller files successfully. Problem appears when I try to send attachment with bigger size. It's been couple of hours I'm trying different solutions. Before it was giving error Error 413: Request Entity Too Large . I updated my code and it looks like this: $mime = rtrim(strtr(base64_encode($mime), '+/', '-_'), '='); $msg = new Google_Service_Gmail_Message(); $msg->setRaw($mime); $sendOptions = [ 'uploadType' => 'resumable' ]; // size of chunks we are going to send to google $chunkSizeBytes = 1 * 1024 * 1024; $client->setDefer

Having trouble reading the text/html message part

巧了我就是萌 提交于 2019-11-29 17:53:18
问题 I'm trying to pull out the subject and body of an email with .Net. It seems to go OK except for the text/html MessagePart. I'm not sure of the encoding etc - has anybody got this working OK? It errors for me when trying to convert. Here is the raw string for the text/html Body Data "PGRpdiBkaXI9Imx0ciI-dGV4dCBpbiBoZXJlPGJyPjwvZGl2Pg0K" which throws an error. "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal

Gmail API domain-wide delegation

蹲街弑〆低调 提交于 2019-11-29 17:41:50
I am using Gmail API and I am trying to fetch emails from all users under company. But when I run code such as: function runAPI(auth) { var gmail = google.gmail('v1'); gmail.users.threads.list({auth: auth, userId: '108800016305523828361'},'',function(err, response){ if (err) { console.log("The API returned an error: " + err); return; } var threads = response.threads; console.log(threads); }) } I get error: The API returned an error: Error: Delegation denied for xxxx@xxxxx.com In admin console I did this: As client name I used id from the client_secret.json file. And for scope, I gave it all

Is there a way in Gmail API to include extra fields (e.g. subject, body) in the message list method?

匆匆过客 提交于 2019-11-29 17:16:19
问题 The "Try it" part documentation allows me to play the API, and the field selector allow me to select a lot of fields, e.g. header, raw, etc. But none of them actually showed up when tried the API. The only thing I saw were still just the message ID and the thread ID. https://developers.google.com/gmail/api/v1/reference/users/messages/list E.g. The following: GET https://www.googleapis.com/gmail/v1/users/{user_id}/messages?**fields=messages(historyId%2Cid%2Cpayload%2Craw%2CsizeEstimate

Handling expired access token in Android without user concent

微笑、不失礼 提交于 2019-11-29 16:49:35
I am trying to use the new Gmail API in a test Android Application. After much battling with the authorization progress I have discovered that specifically, The GoogleAuthUtil.getToken() method does not return a sufficient access token that can be used to access the Gmail API features (will return a 403 error when trying to do any action with the API). That said, the only way I did manage to receive a sufficient token is by doing the authentication process using a WebView and a (Installed application -> Other client ID on the API Console). So in one way it's a win win situation cause I can

node js with gmail api, The API returned an error: Error: unauthorized_client

偶尔善良 提交于 2019-11-29 14:15:02
Edit: The error is happening on on this piece of code: var gmail = google.gmail('v1'); gmail.users.labels.list({ auth: auth, userId: 'me', }, function(err, response) { if (err) { console.log('The API returned an error: ' + err); return; } I am using gmail api with Node js. When I go through their quickstart guide I keep getting this error. https://developers.google.com/gmail/api/quickstart/nodejs The API returned an error: Error: unauthorized_client Keep in mind, I went through the quickstart with my email adress, everything was fine. No errors at all. I decided to create a dummy email for

Gmail api scope & format mismatch

浪尽此生 提交于 2019-11-29 11:09:07
I'm trying to write tiny gmail client for android as training. I took gmail api guide sample from https://developers.google.com/gmail/api/quickstart/android modified it a little to get messages with headers & body by threads. I set scopes to GmailScopes.Gmail_modify and edited main request function as this: private List<String> getDataFromApi() throws IOException { // Get the labels in the user's account. String user = "me"; List<String> labels = new ArrayList<String>(); ListLabelsResponse listResponse = mService.users().labels().list(user).execute(); ListThreadsResponse listThreads = null;

GMail API - Can I send email using the Service Account?

强颜欢笑 提交于 2019-11-29 10:49:22
When I send an email using the GMail API, I get an Access Token for the user to whom the message is to be sent and then when sending the message, I put some value in the From Field. But no matter what I put in the from field, the message in the email shows as From "Me" and is in the Sent mails as well as Inbox. Is there a way, I could use the Service Account to send the email, so that it does not show up as From "Me" and is also not in the Sent Mails. No. The Gmail API is for Gmail users and service accounts are just for doing auth to a real Gmail account, they don't have their own Gmail

Google Cloud Pub/Sub API - Push E-mail

落花浮王杯 提交于 2019-11-29 09:56:21
I'm using node.js to create an app that gets a PUSH from Gmail each time an email is received, checks it against a third party database in a CRM and creates a new field in the CRM if the e-mail is contained there. I'm having trouble using Google's new Cloud Pub/Sub, which seems to be the only way to get push from Gmail without constant polling. I've gone through the instructions here: https://cloud.google.com/pubsub/prereqs but I don't understand how exactly this is supposed to work from an app on my desktop. It seems that pub/sub can connect to a verified domain, but I can't get it to connect

Listing messages with more precision than yyyy/mm/dd

纵然是瞬间 提交于 2019-11-29 07:36:29
I'm trying to get all the messages sent to a user after a certain point in time, by using the Gmail API. I've successfully retrieved messages after a certain date by using the query q=after:2015/01/19 in the API Explorer . I would like to be more specific than this and specify an hour and a minute of the day. Is this possible? I ask since the Advanced Search -specification only contains the most useful operators. You can use a search query to list messages after a certain date with second accuracy. Use the search term after:SOME_TIME_IN_SECONDS_SINCE_EPOCH . Gmail supports the after keyword