gmail-api

gmail api adding label id and thread id while sending as reply (send mail with same thread id while reply)

隐身守侯 提交于 2019-12-13 03:34:27
问题 I'm trying to send mail using gmail api using laravel. my sent msg is $text = 'From: '.$from.' To: '.$to.' Subject:'.$subject.' '.$body.''; $encoded_message = rtrim(strtr(base64_encode($text), '+/', '-_'), '='); $message->setRaw($encoded_message); $message = $service->users_messages->send($userId, $message); I tried to edit label id and thread id as follows, $text = 'labelIds: ':'.SENT.' 'From: '.$from.' To: '.$to.' Subject:'.$subject.' '.$body.''; which gives syntax error. How to add labelid

Cannot display inline images in HTML using Gmail API with RoR?

五迷三道 提交于 2019-12-13 02:27:25
问题 Im building a webmail client in RoR and using Gmail's API. After receiving a response from Gmail's api for a multipart email, I was able to extract the text/html portion and display it in the browser correctly. Everything looks fine except all of the images are broken. Upon inspecting the HTML, it shows <img src="cid:google_logo"> . I understand that this is an inline image referencing the actual image from the attachments. But where and how do I load the attachments into the browser? I've

Move all threads older than X with gmail api

大憨熊 提交于 2019-12-13 02:03:23
问题 I have a folder, Archive where I'd like to store all of my emails from before a given date. In the Gmail web UI, you can accomplish this by doing a search like "in:inbox before:2012/01/01", select all, then "move" from the dropdown. I'd like to do this with the gmail api. How can I accomplish this? Will I need to do the query then iterate through each thread to move it? Or is there a better way? Bonus points for a code snippet / example or link to the relevant section of api docs. 回答1: You

Calling a script with gmail api when an email is sent

会有一股神秘感。 提交于 2019-12-13 01:01:33
问题 We have a sales team that uses gmail to send emails to their customers. We would like to be able to log those emails to our internal system and I wondered if there is anything in the gmail api that would allow for some script to be called when an email is sent? If so, is there any sample code for this functionality? 回答1: There are probably several ways to achieve this, but the steps I use myself are the following: List the messages in the SENT-folder and ask for just the id with a maximum of

Gmail API: How to get access token?

喜你入骨 提交于 2019-12-12 21:25:53
问题 I am testing the Gmail API. So far I have done the following: I have created the project in the Google Developers Console I have enabled the Gmail API . I have created a new Client ID and the client secret . In my PHP script I have installed the PHP Client library and followed the instructions for the setup in PHP. So now when I run the file quickstart.php it gives a link. When I open it, it appears an authorization page where I authorize my application to access the Gmail API. Then it

Nodemailer send calendar event and add it to google calendar

♀尐吖头ヾ 提交于 2019-12-12 18:30:18
问题 I am trying to send a calendar event to Gmail account using nodemailer. Here is my code let transporter = nodemailer.createTransport({ host: 'smtp.gmail.com', port: 587, secure: false, auth: { type: 'OAuth2', user: 'xxx', accessToken: accessToken } }) transporter.sendMail(createGmailCalenderEVent(options), (err, info) => { return err ? reject(err) : resolve(info); }) createGmailCalenderEVent: (options) => { let cal = ical(); cal.addEvent({ start: new Date(options.start), end: new Date(options

how to pass parameters to a triggered function in google-app-script

早过忘川 提交于 2019-12-12 18:18:49
问题 I have a array of recipients and a scheduled time at which the mail has to be sent. I am eager in knowing if there is someway to create a trigger to which i can pass these params(recipients) function send_mail(recipients) { var id = DocumentApp.getActiveDocument().getId(); for(i=0;i<recipients.length;i++) { var url = "https://docs.google.com/feeds/download/documents/export/Export?id="+id+"&exportFormat=html"; var param = { method : "get", headers : {"Authorization": "Bearer " + ScriptApp

Gmail API history request returning Drafts

谁说胖子不能爱 提交于 2019-12-12 18:07:18
问题 I posted a question abt the api returning invalid history ids. I'm trying to figure this out. I think the ids are just not valid in a messages get request, since these are not real messages, rather drafts. I don't know why history list is returning drafts for a messagesAdded request. Can somebody tell me if this is the expected behavior? { "history": [ { "id": "10946109", "messages": [ { "id": "15cc8cd840c2945a", "threadId": "15cc5ccf65733c7f" } ], "messagesAdded": [ { "message": { ...

Is the GmailApp API send limit the same as MailApp?

孤街浪徒 提交于 2019-12-12 18:05:39
问题 I have a free tool for teachers that sends emails to each student in the class about the impact of an upcoming homework assignment on their grade (a 'grade nudge', so each email is custom to the student). This tool sends these emails through GmailApp.sendEmail method and the script executes under the user's (teacher's/professor's in this context) Google account. While a lot of universities have G Suite accounts (where a limit of 1500 is effectively so large it doesn't matter), not all of them

Rails: Send email using Gmail API with attachment return only encoded file not

笑着哭i 提交于 2019-12-12 14:23:48
问题 I am trying to send an email using gmail API. My Ruby code as you can see below works well without an attachment: client = google_client user_id token = Token.find_by_user_id(user_id) access_token = token.access_token gmail = Google::Apis::GmailV1::GmailService.new gmail.authorization = client message = Mail.new message.date = Time.now message.subject = 'Supertram p' message.body = "<p>Hi Alex, how's life?</p>" message.content_type = 'text/html' message.from = self.email message.to = 'email