gmail-api

Creating a Message for Gmail API in C#

a 夏天 提交于 2019-11-27 18:12:28
问题 I'm looking at using the Gmail API in an application I'm working on. However, I'm not sure how to change their Java or Python examples over to C#. How exactly does the existing sample change over? Sample found here. 回答1: Here is what I was able to get working, using MimeKit. public void SendEmail(MyInternalSystemEmailMessage email) { var mailMessage = new System.Net.Mail.MailMessage(); mailMessage.From = new System.Net.Mail.MailAddress(email.FromAddress); mailMessage.To.Add(email.ToRecipients

Base64 decoding of MIME email not working (GMail API)

血红的双手。 提交于 2019-11-27 17:49:06
问题 I'm using the GMail API to retrieve an email contents. I am getting the following base64 encoded data for the body: http://hastebin.com/ovucoranam.md But when I run it through a base64 decoder, it either returns an empty string (error) or something that resembles the HTML data but with a bunch of weird characters. Help? 回答1: I'm not sure if you've solved it yet, but GmailGuy is correct. You need to convert the body to the Base64 RFC 4648 standard. The jist is you'll need to replace - with +

Sending email via gmail & python

你离开我真会死。 提交于 2019-11-27 17:44:43
What is the recommended way of sending emails with gmail and python? There are a lot of SO threads, but most are old and also smtp with username & password is not working any more or the user has to downgrade the security of their gmail (for example see here ). Is OAuth the recommended way? apadana The answer shows how to send email with gmail API and python. Also updated the answer to send emails with attachment. Gmail API & OAuth -> no need to save the username and password in the script. The first time the script opens a browser to authorize the script and will store credentials locally (it

How to get full message body in Gmail?

佐手、 提交于 2019-11-27 17:39:57
问题 I want to get full message body. So I try: Message gmailMessage = service.users().messages().get("me", messageId).setFormat("full").execute(); That to get body, I try: gmailMessage.getPayload().getBody().getData() but result always null . How to get full message body? 回答1: I tried this way, since message.getPayload().getBody().getParts() was always null import com.google.api.client.repackaged.org.apache.commons.codec.binary.Base64; import com.google.api.client.repackaged.org.apache.commons

Forward mail using gmail API

牧云@^-^@ 提交于 2019-11-27 16:29:25
问题 Is there any code provided by google to forward mail. because i haven't found one. If there is any way to forward mail using GMAIL API with extra content to send with original message. Please help. 回答1: I don't see any specific forward operation... You'll have to: get the message, add your extra content to the top of the original message and change the to address, then send it. Not much help to you but take note of the Threads. 来源: https://stackoverflow.com/questions/30995341/forward-mail

Creating draft via Google Gmail API

倾然丶 夕夏残阳落幕 提交于 2019-11-27 16:27:39
I am trying to create a draft message for a logged in user but keep getting the error Missing draft message when I run the below require 'google/api_client' client = Google::APIClient.new client.authorization.client_id = ENV['GOOGLE_CLIENT_ID'] client.authorization.client_secret = ENV['GOOGLE_CLIENT_SECRET'] client.authorization.grant_type = 'refresh_token' client.authorization.refresh_token = User.last.refresh_token token = client.authorization.fetch_access_token! gmail = client.discovered_api('gmail', 'v1') params = { 'userId' => 'me', 'draft' => { 'message' => {'raw' => 'test email' } } } #

Get sender email from gmail-api

China☆狼群 提交于 2019-11-27 16:11:25
I am using the gmail-api and having trouble getting the email of the sender. I am talking about the "full" format of the email. I consider the email of the sender to be the one that is actually written in the "From" field using the web interface of gmail. The headers of this full format usually include stuff like "X-Original-Authentication-Results" from which normally I can retrieve the smtp.mail value which is the sender's email but there are other emails where this header cannot be found. This is my code so far: if ("X-Original-Authentication-Results" == $header["name"]) { $value = $header[

How To Send A Reply With Gmail API

孤街醉人 提交于 2019-11-27 15:43:56
I have two gmail accounts I created a thread consisting of five messages and retreived them with gmail gapi at this page https://developers.google.com/gmail/api/v1/reference/users/threads/get . This is what I got: As you can see, the ids don't match, although they identify the exact same letters. Why this happens, and how can i get the unified id? P.S. The real reason I am doing this is that I need to send a reply to a message with gmail API, but to do that, you need to know the id of the message that you reply to. And if I reply to the message with id that I have ( not the message id that the

How to use the Gmail API, OAuth2 for Apps Script, and Domain-Wide Delegation to set email signatures for users in a G Suite domain

不想你离开。 提交于 2019-11-27 14:14:51
This is a follow-up to a previous question/answer I posted ( How to use the Google Email Settings API and the OAuth2 for Apps Script Library to set email signatures for users in a Google Apps domain ), but I'm creating a new question since the Email Settings API has been deprecated and the process is significantly different now. As the administrator of a G Suite domain, how do you use the Gmail API to programmatically set the email signatures of users in your domain through Google Apps Script? This method uses the Gmail API, the OAuth2 for Apps Script library, and "Domain-wide Delegation of

Reading messages from Gmail, in PHP, using Gmail API

允我心安 提交于 2019-11-27 13:00:09
问题 I have donwloaded new Gmail API source code from Google PHP client library. I inititalized the service using: set_include_path("./google-api-php-client-master/src/".PATH_SEPARATOR.get_include_path()); require_once 'Google/Client.php'; require_once 'Google/Service/Gmail.php'; $client = new Google_Client(); $client->setClientId($this->config->item('gmailapi_clientid')); $client->setClientSecret($this->config->item('gmailapi_clientsecret')); $client->setRedirectUri(base_url('auth')); $client-