> Source: https://txtfetch.com/sources/email-inbox > Plain-text twin — every page on txtfetch.com has one. https://txtfetch.com/text --- # Extract text from Email inbox The whole message, not a link, since a private inbox has no download URL. Here's how a document actually gets from Email inbox to a txtfetch response. ## The problem An email message lives inside a private inbox, with no equivalent of a shareable file link. Reaching it always means calling a mail API or protocol with your own credentials first. ?url= has nothing to point at until you do. POST the bytes, and why | Pre-authenticated URL? | No — a mailbox has no download URL at all | | --- | --- | | txtfetch path | POST the bytes | | Link lifetime | N/A | | The trap | The Gmail API's raw field is base64url-encoded text, not a file. Decode it before you write the .eml file, or txtfetch reads garbage. | A mailbox has no public download URL for any message. Fetch the raw message yourself, then POST it to txtfetch as a file. ## How it works Call the Gmail API's users.messages.get with format=raw, or run an IMAP FETCH BODY\[\] over a logged-in connection. Either path returns the message as a complete RFC 822 document, headers and attachments included. Decode the Gmail API's base64url raw field into bytes, then POST that .eml file to txtfetch. txtfetch parses the message body and every attachment in the same call. the script A plain HTTP call against Email inbox's own REST API, then a plain call to txtfetch. No vendor SDK either side. Python ```python import base64 import os import requests MESSAGE_ID = "18c8f2a1b3d4e5f6" headers = {"Authorization": f"Bearer {os.environ['GMAIL_ACCESS_TOKEN']}"} message = requests.get( f"https://gmail.googleapis.com/gmail/v1/users/me/messages/{MESSAGE_ID}", headers=headers, params={"format": "raw"}, ) message.raise_for_status() raw_bytes = base64.urlsafe_b64decode(message.json()["raw"]) r = requests.post( "https://api.txtfetch.com/v1/extract", headers={"Authorization": f"Bearer {os.environ['TXTFETCH_KEY']}"}, files={"file": ("message.eml", raw_bytes)}, ) print(r.json()["extracted_text"]) ``` JavaScript ```javascript const messageId = "18c8f2a1b3d4e5f6"; const gmailRes = await fetch( `https://gmail.googleapis.com/gmail/v1/users/me/messages/${messageId}?format=raw`, { headers: { Authorization: `Bearer ${process.env.GMAIL_ACCESS_TOKEN}` } }, ); const { raw } = await gmailRes.json(); const rawBytes = Buffer.from(raw, "base64url"); const form = new FormData(); form.append("file", new Blob([rawBytes]), "message.eml"); const res = await fetch("https://api.txtfetch.com/v1/extract", { method: "POST", headers: { Authorization: `Bearer ${process.env.TXTFETCH_KEY}` }, body: form, }); const { extracted_text } = await res.json(); console.log(extracted_text); ``` txtfetch ships no connector, plugin, or client for Email inbox. The script above is the whole integration. Fetch the document with Email inbox's own API, then hand it to txtfetch, the same as any other source of text. frequently asked questions **Does txtfetch have a Gmail or Outlook connector?**: No. txtfetch ships no mailbox connector for any provider. Fetch the raw message with the provider's own API, then POST it to txtfetch as a file. **Can txtfetch read my inbox directly?**: No. txtfetch never holds mailbox credentials of any kind. Your own code authenticates, fetches the message, and sends only that message's bytes. **Does txtfetch see the message's attachments too?**: Yes. An RFC 822 .eml file carries its attachments inline, and txtfetch parses the message body and every attachment in the same request. sources - [Gmail API: users.messages.get](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.messages/get) Accessed 2026-09 directional ## Related - [Extract text from email](https://txtfetch.com/extract/email), what txtfetch pulls out of an .eml, .msg, or .mbox file. - [Free message-to-text converter](https://txtfetch.com/tools/email-to-text), drop a saved message in your browser, with nothing uploaded. - [Integrations](https://txtfetch.com/integrations), for wiring this into a no-code automation platform instead of a script. - [Ingest into a vector store](https://txtfetch.com/ingest), for where the extracted text goes next. - [Async jobs & webhooks](https://txtfetch.com/docs/async), for a source that's large or slow to fetch. - [Error reference](https://txtfetch.com/docs/errors), for what a failed `?url=` fetch returns. other sources - [Extract text from Google Drive →](https://txtfetch.com/sources/google-drive) - [Extract text from SharePoint & OneDrive →](https://txtfetch.com/sources/sharepoint-onedrive) - [Extract text from Amazon S3 →](https://txtfetch.com/sources/amazon-s3) - [Extract text from Dropbox →](https://txtfetch.com/sources/dropbox) - [Extract text from Confluence →](https://txtfetch.com/sources/confluence) - [All sources →](https://txtfetch.com/sources) ## Point it at your Email inbox files. Pass a signed URL and the text comes back. There is no connector to install. [Get an API key →](https://app.txtfetch.com/signup) [See the URL docs →](https://txtfetch.com/docs)