Friday, 15 July 2011

python - Retrieve email/message body in html using Gmail API -



python - Retrieve email/message body in html using Gmail API -

is there way retrieve message body in html form using gmail api ?

i have gone through message.get docs.. tried changing format params full, minimal & raw. id did not help. returning plain text of mail service body.

description of format values :

"full": returns parsed email message content in payload field , raw field not used. (default)

"minimal": returns email message metadata such identifiers , labels, not homecoming email headers, body, or payload.

"raw": returns entire email message content in raw field string , payload field not used. includes identifiers, labels, metadata, mime structure, , little body parts (typically less 2kb).

can't message body in html form or there other way mail service displayed on screen minimal difference when see in app or gmail ?

email messages have both html , plain text content have multiple payload parts, , part mimetype "text/html" contains html content. can find logic like:

var part = message.parts.filter(function(part) { homecoming part.mimetype == 'text/html'; }); var html = urlsafebase64decode(part.body.data);

python gmail-api

No comments:

Post a Comment