{"id":32955583,"url":"https://github.com/gmailgem/gmail","last_synced_at":"2025-11-13T08:00:42.642Z","repository":{"id":25929793,"uuid":"29371025","full_name":"gmailgem/gmail","owner":"gmailgem","description":"A Rubyesque interface to Gmail, with all the tools you'll need.","archived":false,"fork":false,"pushed_at":"2024-01-18T07:45:11.000Z","size":404,"stargazers_count":409,"open_issues_count":21,"forks_count":124,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-11-06T12:08:59.677Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"zzuu666/antue","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gmailgem.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-01-16T22:34:54.000Z","updated_at":"2025-10-17T18:35:58.000Z","dependencies_parsed_at":"2024-05-01T13:20:09.729Z","dependency_job_id":"85ed9a4b-3bb6-4fdd-82ca-a56186a841d1","html_url":"https://github.com/gmailgem/gmail","commit_stats":{"total_commits":271,"total_committers":54,"mean_commits":5.018518518518518,"dds":0.8154981549815499,"last_synced_commit":"c5e938942675fb3a3f71fa957e299a1cd1ee1577"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/gmailgem/gmail","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmailgem%2Fgmail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmailgem%2Fgmail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmailgem%2Fgmail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmailgem%2Fgmail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gmailgem","download_url":"https://codeload.github.com/gmailgem/gmail/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmailgem%2Fgmail/sbom","scorecard":{"id":430601,"data":{"date":"2025-08-11","repo":{"name":"github.com/gmailgem/gmail","commit":"c5e938942675fb3a3f71fa957e299a1cd1ee1577"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":8,"reason":"Found 12/14 approved changesets -- score normalized to 8","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 28 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T03:14:35.883Z","repository_id":25929793,"created_at":"2025-08-19T03:14:35.884Z","updated_at":"2025-08-19T03:14:35.884Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284100246,"owners_count":26947309,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-12T02:00:06.336Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2025-11-12T22:00:46.434Z","updated_at":"2025-11-13T08:00:42.637Z","avatar_url":"https://github.com/gmailgem.png","language":"Ruby","readme":"\u003cimg alt=\"Gmail for Ruby\" src=\"https://cloud.githubusercontent.com/assets/27655/5792399/fd5d076e-9f59-11e4-826c-22c311e38356.png\"\u003e\n\n[![Build Status](https://travis-ci.org/gmailgem/gmail.svg)](https://travis-ci.org/gmailgem/gmail)\n[![Code Climate](https://codeclimate.com/github/gmailgem/gmail.svg)](https://codeclimate.com/github/gmailgem/gmail)\n[![Gem Version](https://badge.fury.io/rb/gmail.svg)](https://rubygems.org/gems/gmail)\n[![Coverage Status](https://coveralls.io/repos/gmailgem/gmail/badge.svg?branch=master\u0026service=github\u0026nocache=true)](https://coveralls.io/github/gmailgem/gmail?branch=master)\n\n## Deprecation Notice\n\nAs of version 0.7.0 (Aug 19, 2018) this gem is officially deprecated and will no longer be maintained.\nPlease instead use [Google's official Gmail API Ruby Client](https://developers.google.com/gmail/api/quickstart/ruby),\nwhich uses the Gmail API rather than IMAP and has significantly better performance and reliability.\n\n## Overview\n\nThis gem is a Rubyesque interface to Google's Gmail via IMAP. Search, read and send multipart emails,\narchive, mark as read/unread, delete emails, and manage labels. It's based on [Daniel Parker's ruby-gmail gem](https://github.com/dcparker/ruby-gmail).\n\n## Reporting Issues\n\nAs of version 0.7.x, we are accepting pull requests for critical security patches only.\n\nThis gem uses the [Mail gem](https://github.com/mikel/mail) for messages, attachments, etc. Unless your issue is related to Gmail integration specifically, please refer to [RFC-5322 (email specification)](https://tools.ietf.org/html/rfc5322) and the [Mail gem](https://github.com/mikel/mail).\n\n## Installation\n\nYou can install it easy using rubygems:\n\n    sudo gem install gmail\n    \nOr install it manually:\n\n    git clone git://github.com/gmailgem/gmail.git\n    cd gmail\n    rake install\n\ngmail gem has the following dependencies (with Bundler all will be installed automatically):\n\n* mail\n* gmail_xoauth\n\n## Version Support\n\n* Ruby 2.0.0+ is supported.\n* Ruby 1.9.3 is supported but deprecated.\n* Ruby 1.8.7 users should use gmail v0.4.1\n\n## Features\n\n* Search emails\n* Read emails (handles attachments)\n* Emails: label, archive, delete, mark as read/unread/spam, star\n* Manage labels\n* Create and send multipart email messages in plaintext and/or html, with inline \n  images and attachments\n* Utilizes Gmail's IMAP \u0026 SMTP, MIME-type detection and parses and generates \n  MIME properly.\n\n## Basic usage\n\nFirst of all require the `gmail` library.\n\n```ruby\nrequire 'gmail'\n```\n\n### Authenticating gmail sessions\n\nThis will let you automatically log in to your account. \n\n```ruby\ngmail = Gmail.connect(username, password)\n# play with your gmail...\ngmail.logout\n```\n\nIf you pass a block, the session will be passed into the block, and the session \nwill be logged out after the block is executed.\n\n```ruby\nGmail.connect(username, password) do |gmail|\n  # play with your gmail...\nend\n```\n\nExamples above are \"quiet\", it means that it will not raise any errors when \nsession couldn't be started (eg. because of connection error or invalid \nauthorization data). You can use connection which handles errors raising:\n\n```ruby\nGmail.connect!(username, password)\nGmail.connect!(username, password) {|gmail| ... play with gmail ... }\n```\n\nYou can also check if you are logged in at any time:\n\n```ruby\nGmail.connect(username, password) do |gmail|\n  gmail.logged_in?\nend\n```\n\n### XOAuth authentication\n\nFrom v0.4.0 it's possible to authenticate with your Gmail account using XOAuth\nmethod. It's very simple:\n\n```ruby\ngmail = Gmail.connect(:xoauth, \"email@domain.com\", \n  :token           =\u003e 'TOKEN',\n  :secret          =\u003e 'TOKEN_SECRET',\n  :consumer_key    =\u003e 'CONSUMER_KEY',\n  :consumer_secret =\u003e 'CONSUMER_SECRET'\n)\n```\n\n```ruby\ngmail = Gmail.connect(:xoauth2, 'email@domain.com', 'ACCESS_TOKEN')\n```\n    \nFor more information check out the [gmail_xoauth](https://github.com/nfo/gmail_xoauth)\ngem from Nicolas Fouché.\n\n### XOAuth2 authentication\n\nYou can use the oauth2 token to connect to Gmail. The connect method takes 3 paramaters.\n\n```ruby\ngmail = Gmail.connect(:xoauth2, \"email@domain.com\", \"TOKEN\")\n```\nYou can use [omniauth-google-oauth2](https://github.com/zquestz/omniauth-google-oauth2) to fetch the token. Once the omniauth authorization has been completed, you'll be left with a `auth.credentials.token` you can pass in as the third paramater to `Gmail.connect`.\n\n### Counting and gathering emails\n    \nGet counts for messages in the inbox:\n\n```ruby\ngmail.inbox.count\ngmail.inbox.count(:unread)\ngmail.inbox.count(:read)\n```\n\nCount with some criteria:\n\n```ruby\ngmail.inbox.count(:after =\u003e Date.parse(\"2010-02-20\"), :before =\u003e Date.parse(\"2010-03-20\"))\ngmail.inbox.count(:on =\u003e Date.parse(\"2010-04-15\"))\ngmail.inbox.count(:from =\u003e \"myfriend@gmail.com\")\ngmail.inbox.count(:to =\u003e \"directlytome@gmail.com\")\n```\n\nCombine flags and options:\n\n```ruby\ngmail.inbox.count(:unread, :from =\u003e \"myboss@gmail.com\")\n```\n\nBrowsing labeled emails is similar to work with inbox.\n\n```ruby\ngmail.mailbox('Urgent').count\n```\n\nGetting messages works the same way as counting: Remember that every message in a \nconversation/thread will come as a separate message.\n\n```ruby\ngmail.inbox.emails(:unread, :before =\u003e Date.parse(\"2010-04-20\"), :from =\u003e \"myboss@gmail.com\")\n```\n\nThe [gm option](https://developers.google.com/gmail/imap_extensions?csw=1#extension_of_the_search_command_x-gm-raw) enables use of the Gmail search syntax.\n\n```ruby\ngmail.inbox.emails(gm: '\"testing\"')\n```\n\nYou can also use one of aliases:\n\n```ruby\ngmail.inbox.find(...)\ngmail.inbox.search(...)\ngmail.inbox.mails(...)\n```\n\nAlso you can manipulate each message using block style:\n\n```ruby\ngmail.inbox.find(:unread).each do |email|\n  email.read!\nend\n```\n\nNote: The `:before` and `:after` filters only go as far as to search for messages on the date:\n\n```ruby\n# E.g. the following will return messages between 2016-01-01 00:00:00 and 2016-04-05 00:00:00\ngmail.inbox.find(\n    :after =\u003e Time.parse('2016-01-01 07:50:21'),\n    :before =\u003e Time.parse('2016-04-05 21:55:05')\n    )\n```\n\n### Working with emails!\n\nAny news older than 4-20, mark as read and archive it:\n\n```ruby\ngmail.inbox.find(:before =\u003e Date.parse(\"2010-04-20\"), :from =\u003e \"news@nbcnews.com\").each do |email|\n  email.read! # can also unread!, spam! or star!\n  email.archive!\nend\n```\n\nDelete emails from X:\n\n```ruby\ngmail.inbox.find(:from =\u003e \"x-fiance@gmail.com\").each do |email|\n  email.delete!\nend\n```\n\nSave all attachments from the \"Faxes\" label to a local folder (uses functionality from `Mail` gem):\n\n```ruby\nfolder = Dir.pwd # for example\ngmail.mailbox(\"Faxes\").emails.each do |email|\n  email.message.attachments.each do |f|\n    File.write(File.join(folder, f.filename), f.body.decoded)\n  end\nend\n```\n\nYou can also use `#label` method instead of `#mailbox`:\n\n```ruby\ngmail.label(\"Faxes\").emails.each {|email| ... }\n```\n\nSave just the first attachment from the newest unread email (assuming pdf):\n\n```ruby\nemail = gmail.inbox.find(:unread).first\nattachment = email.attachments[0]\nFile.write(File.join(folder_path, attachment.filename), attachment.body.decoded)\n```\n\nAdd a label to a message:\n\n```ruby\nemail.label(\"Faxes\")\n```\n\nExample above will raise error when you don't have the `Faxes` label. You can\navoid this using:\n\n```ruby\nemail.label!(\"Faxes\") # The `Faxes` label will be automatically created now\n```\n\nYou can also move message to a label/mailbox:\n\n```ruby\nemail.move_to(\"Faxes\")\nemail.move_to!(\"NewLabel\")\n```\n\nThere are also few shortcuts to mark messages quickly:\n\n```ruby\nemail.read!\nemail.unread!\nemail.spam!\nemail.star!\nemail.unstar!\n```\n\n### Managing labels\n\nWith Gmail gem you can also manage your labels. You can get list of defined \nlabels:\n\n```ruby\ngmail.labels.all\n```\n\nCreate new label:\n\n```ruby\ngmail.labels.new(\"Urgent\")\ngmail.labels.add(\"AnotherOne\")\n```\n\nRemove labels:\n\n```ruby\ngmail.labels.delete(\"Urgent\")\n```\n\nOr check if given label exists:\n\n```ruby\ngmail.labels.exists?(\"Urgent\")     # =\u003e false\ngmail.labels.exists?(\"AnotherOne\") # =\u003e true\n```\n\nLocalize label names using the LIST special-use extension flags,\n:Inbox, :All, :Drafts, :Sent, :Trash, :Important, :Junk, and :Flagged\n\n```ruby\ngmail.labels.localize(:all) # =\u003e \"[Gmail]\\All Mail\"\n                            # =\u003e \"[Google Mail]\\All Mail\"\n```\n\n### Composing and sending emails\n\nCreating emails now uses the amazing [Mail](http://rubygems.org/gems/mail) rubygem. \nSee its [documentation here](http://github.com/mikel/mail). The Ruby Gmail will \nautomatically configure your Mail emails to be sent via your Gmail account's SMTP, \nso they will be in your Gmail's \"Sent\" folder. Also, no need to specify the \"From\" \nemail either, because ruby-gmail will set it for you.\n\n```ruby\ngmail.deliver do\n  to \"email@example.com\"\n  subject \"Having fun in Puerto Rico!\"\n  text_part do\n    body \"Text of plaintext message.\"\n  end\n  html_part do\n    content_type 'text/html; charset=UTF-8'\n    body \"\u003cp\u003eText of \u003cem\u003ehtml\u003c/em\u003e message.\u003c/p\u003e\"\n  end\n  add_file \"/path/to/some_image.jpg\"\nend\n```\n\nOr, compose the message first and send it later\n\n```ruby\nemail = gmail.compose do\n  to \"email@example.com\"\n  subject \"Having fun in Puerto Rico!\"\n  body \"Spent the day on the road...\"\nend\nemail.deliver! # or: gmail.deliver(email)\n```\n\n## Troubleshooting\n\nIf you are having trouble connecting to Gmail:\n* Please ensure your account is verified\n* In [Gmail Security Settings](https://www.google.com/settings/security), enable access for less secure applications.\n* Read [this support answer re: suspicious activity](https://support.google.com/mail/answer/78754) and try things like entering a captcha.\n\n## Authors\n\n#### Core Team\n\nThis project follows on Open Governance model. The Core Team is responsible for technical guidance, reviewing/merging PRs, and releases.\n\n* Jeff Carbonella - [@jcarbo](https://github.com/jcarbo)\n* Johnny Shields - [@johnnyshields](https://github.com/johnnyshields)\n* Alexandre Loureiro Solleiro - [@webcracy](https://github.com/webcracy)\n* Justin Grevich - [@jgrevich](https://github.com/jgrevich)\n* [@bootstraponline](https://github.com/bootstraponline)\n* Nathan Herald - [@myobie](https://github.com/myobie)\n\n#### Legacy Contributors\n\n* Kriss Kowalik - [@nu7hatch](https://github.com/nu7hatch)\n* Daniel Parker - [@dcparker](https://github.com/dcparker)\n* Refer to [CHANGELOG](https://github.com/gmailgem/gmail/blob/master/CHANGELOG.md) for individual contributions\n\n## Copyright\n\n* Copyright (c) 2015-2018 GmailGem team\n* Copyright (c) 2010-2014 Kriss 'nu7hatch' Kowalik\n* Copyright (c) 2009-2010 BehindLogic\n\nLicensed under the MIT license. See [LICENSE](https://github.com/gmailgem/gmail/blob/master/LICENSE) for details.\n","funding_links":[],"categories":["Third-party APIs"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmailgem%2Fgmail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgmailgem%2Fgmail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmailgem%2Fgmail/lists"}