def SendSimpleMail(to, subject, body, user_id="me", cc="", bcc=""): # {{{ subject = subject.encode("utf-8") body = body.encode("utf-8") credentials = authorization.get_credentials(SCOPES, CLIENT_SECRET_FILE, APPLICATION_NAME) service = build('gmail', 'v1', http=credentials.authorize(Http())) SendMessage(service, user_id, CreateMessage(user_id, to, cc, bcc, subject, body)) # }}}
def test(): credentials = authorization.get_credentials(SCOPES, CLIENT_SECRET_FILE, APPLICATION_NAME) service = build("gmail", "v1", http=credentials.authorize(Http())) results = service.users().labels().list(userId="me").execute() labels = results.get("labels", []) if not labels: print "No labels found." else: print "Labels:" i = 1 for label in labels: try: wb = Workbook("Book1") Range((i, 1)).value = label["name"].encode("shift-jis") except: print "error" i += 1
def test(): credentials = authorization.get_credentials(SCOPES, CLIENT_SECRET_FILE, APPLICATION_NAME) service = build('gmail', 'v1', http=credentials.authorize(Http())) results = service.users().labels().list(userId='me').execute() labels = results.get('labels', []) if not labels: print 'No labels found.' else: print 'Labels:' i = 1 for label in labels: try: wb = Workbook('Book1') Range((i, 1)).value = label['name'].encode("shift-jis") except: print "error" i += 1
def SendSimpleMail(to, subject, body, user_id="me", cc="", bcc=""):# {{{ subject = subject.encode("utf-8") body = body.encode("utf-8") credentials = authorization.get_credentials(SCOPES,CLIENT_SECRET_FILE,APPLICATION_NAME) service = build('gmail', 'v1', http=credentials.authorize(Http())) SendMessage(service, user_id, CreateMessage(user_id, to, cc, bcc, subject, body))# }}}