{"id":13736572,"url":"https://github.com/r-lib/gmailr","last_synced_at":"2026-01-30T18:00:52.823Z","repository":{"id":18466101,"uuid":"21660856","full_name":"r-lib/gmailr","owner":"r-lib","description":"Access the Gmail RESTful API from R.","archived":false,"fork":false,"pushed_at":"2026-01-27T23:36:38.000Z","size":11617,"stargazers_count":236,"open_issues_count":21,"forks_count":55,"subscribers_count":10,"default_branch":"main","last_synced_at":"2026-01-28T12:53:49.812Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://gmailr.r-lib.org","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r-lib.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2014-07-09T16:54:55.000Z","updated_at":"2026-01-27T23:33:14.000Z","dependencies_parsed_at":"2022-09-11T20:20:47.827Z","dependency_job_id":"3fd8e9cf-2d7c-4291-8391-364a7b7589dc","html_url":"https://github.com/r-lib/gmailr","commit_stats":{"total_commits":414,"total_committers":17,"mean_commits":"24.352941176470587","dds":0.3526570048309179,"last_synced_commit":"c5d6c054a2b7157a26f9c3908b9cc7be43cd29fb"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/r-lib/gmailr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fgmailr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fgmailr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fgmailr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fgmailr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-lib","download_url":"https://codeload.github.com/r-lib/gmailr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fgmailr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28917033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T16:37:38.804Z","status":"ssl_error","status_checked_at":"2026-01-30T16:37:37.878Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T03:01:24.289Z","updated_at":"2026-01-30T18:00:52.816Z","avatar_url":"https://github.com/r-lib.png","language":"R","funding_links":[],"categories":["R","Backend"],"sub_categories":["G Suite Integration"],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\ncan_decrypt \u003c- gargle::secret_has_key(\"GMAILR_KEY\")\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  error = TRUE,\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\",\n  purl = can_decrypt,\n  eval = can_decrypt\n)\n```\n\n```{r eval = !can_decrypt, echo = FALSE, comment = NA}\nmessage(\"No token available. Code chunks will not be evaluated.\")\n```\n\n```{r readme-auth, include = FALSE}\ngmailr:::gm_auth_testing()\n```\n\n# gmailr\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/gmailr)](https://CRAN.R-project.org/package=gmailr)\n[![R-CMD-check](https://github.com/r-lib/gmailr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/gmailr/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/r-lib/gmailr/graph/badge.svg)](https://app.codecov.io/gh/r-lib/gmailr)\n\u003c!-- badges: end --\u003e\n\nExposing the [Gmail API](https://developers.google.com/gmail/api) from R.\n\n## Installation\n\nInstall the released version of gmailr from CRAN:\n\n```{r eval = FALSE}\ninstall.packages(\"gmailr\")\n```\n\nOr install the development version from GitHub with:\n\n```{r eval = FALSE}\n# install.packages(\"pak\")\npak::pak(\"r-lib/gmailr\")\n```\n\n## Attach gmailr\n\n```{r, message = FALSE}\nlibrary(gmailr)\n```\n\n## Setup and auth\n\nIn order to use gmailr, you **must** provide your own OAuth client.\nThis is documented in the article [Set up an OAuth client](https://gmailr.r-lib.org/dev/articles/oauth-client.html).\nThe article goes deeply into how to create an OAuth client and also how to configure it for gmailr's use.\nIf you already have an OAuth client or know how to create one, the help topics for `?gm_auth_configure` and `?gm_default_oauth_client` are more concise resources for just the client configuration piece.\n\nConfiguring an OAuth client is step 1 of 2 for getting ready to use gmailr.\nStep 2 is to complete the so-called \"OAuth dance\", which is triggered automatically upon first need.\nYou are taken to a web browser, where you must select or login as the Google user you want to use (authenticate yourself) and give your OAuth client permission to do Gmail stuff on your behalf (authorize).\nThe OAuth dance does not (necessarily) need to be repeated in subsequent sessions.\nSee `?gm_auth` if these defaults aren't appropriate for your use case and you'd like to take more control.\n\nYou can call `gm_profile()` to confirm that you are using the intended Google identity.\n\n## Compose and send an email\n\nCreate a new email with `gm_mime()` and build it up from parts, using helper functions like `gm_to()` and `gm_subject()`.\n\n```{r eval = FALSE}\ntest_email \u003c-\n  gm_mime() |\u003e\n  gm_to(\"PUT_A_VALID_EMAIL_ADDRESS_THAT_YOU_CAN_CHECK_HERE\") |\u003e\n  gm_from(\"PUT_THE_GMAIL_ADDRESS_ASSOCIATED_WITH_YOUR_GOOGLE_ACCOUNT_HERE\") |\u003e\n  gm_subject(\"this is just a gmailr test\") |\u003e\n  gm_text_body(\"Can you hear me now?\")\n```\n\n```{r include = FALSE}\ntest_email \u003c-\n  gm_mime() |\u003e\n  gm_to(\"gargle-testuser@posit.co\") |\u003e\n  gm_from(\"gargle-testuser@posit.co\") |\u003e\n  gm_subject(\"this is just a gmailr test\") |\u003e\n  gm_text_body(\"Can you hear me now?\")\n```\n\nWhen developing the message, you might want to use `gm_create_draft()`, if you'd like to view a draft and verify that it's formatted as you expect.\nThen you can send the draft with `gm_send_draft()` or send the original MIME message with `gm_send_message()`.\n\n```{r}\n# Verify it looks correct, i.e. look at your Gmail drafts in the browser\nd \u003c- gm_create_draft(test_email)\n\n# If all is good with your draft, then you can send the existing draft\ngm_send_draft(d)\n\n# or the existing MIME message\ngm_send_message(test_email)\n```\n\n## Read email\n\nYou can retrieve all email threads with `gm_threads()` or retrieve a specific thread with `gm_thread()`.\nYou can then isolate a specific message and access its parts.\n\n```{r}\n# view recent threads\nmy_threads \u003c- gm_threads(num_results = 10)\n\n# retrieve the latest thread by retrieving the first ID\nlatest_thread \u003c- gm_thread(gm_id(my_threads)[[1]])\n\n# messages in the thread will now be in a list\n# retrieve parts of a specific message with the accessors\nmy_msg \u003c- latest_thread$messages[[1]]\n\ngm_date(my_msg)\ngm_subject(my_msg)\ngm_body(my_msg)\n```\n\n## Where to learn more\n\nMore details are available in the [Get started](https://gmailr.r-lib.org/articles/gmailr.html) article and in gmailr's [other articles](https://gmailr.r-lib.org/articles/index.html).\n\n## Policies\n\n[Privacy policy](https://tidyverse.org/google_privacy_policy/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fgmailr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-lib%2Fgmailr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fgmailr/lists"}