Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get subject of email from gmail using google API using python? [closed]

How to get the subject of a message using Gmail API using python?

like image 656
Nishanth Duvva Avatar asked May 31 '17 09:05

Nishanth Duvva


People also ask

How do I send HTML formatted emails through the Gmail API?

message = MIMEText(message_text, 'html') <-- add the 'html' as the second parameter of the MIMEText object constructor.


1 Answers

Users.messages: list returns a list of messages. Each message is a Users.messages resource

Pay load header contains subject

  "payload": {
    "partId": string,
    "mimeType": string,
    "filename": string,
    "headers": [
      {
        "name": string,
        "value": string
      }
    ],

payload.headers[] list List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as To, From, and Subject.

There is python code on the google developer site which will help you get started python quickstart

like image 177
DaImTo Avatar answered Oct 02 '22 14:10

DaImTo