{"id":13542658,"url":"https://github.com/ankane/mailkick","last_synced_at":"2025-11-17T14:12:28.144Z","repository":{"id":16666710,"uuid":"19422384","full_name":"ankane/mailkick","owner":"ankane","description":"Email subscriptions for Rails","archived":false,"fork":false,"pushed_at":"2025-10-23T17:20:33.000Z","size":207,"stargazers_count":964,"open_issues_count":0,"forks_count":78,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-10-27T10:55:34.335Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ankane.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2014-05-04T08:40:30.000Z","updated_at":"2025-10-23T17:20:37.000Z","dependencies_parsed_at":"2023-12-26T17:26:50.758Z","dependency_job_id":"48ef1f17-f10f-41f9-82f3-92b41d334b8b","html_url":"https://github.com/ankane/mailkick","commit_stats":{"total_commits":227,"total_committers":16,"mean_commits":14.1875,"dds":0.5638766519823788,"last_synced_commit":"83952e213fe086455041fa66db26c86c55910094"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/ankane/mailkick","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fmailkick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fmailkick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fmailkick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fmailkick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ankane","download_url":"https://codeload.github.com/ankane/mailkick/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fmailkick/sbom","scorecard":{"id":197152,"data":{"date":"2025-08-11","repo":{"name":"github.com/ankane/mailkick","commit":"0d83f3915d13174a84306ee6c6e3f20b80b4706e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.4,"checks":[{"name":"Maintained","score":10,"reason":"23 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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":10,"reason":"no dangerous workflow patterns detected","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":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Info: no jobLevel write permissions found"],"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/ankane/mailkick/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/ankane/mailkick/build.yml/master?enable=pin","Info:   0 out of   1 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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"}}]},"last_synced_at":"2025-08-16T22:01:11.458Z","repository_id":16666710,"created_at":"2025-08-16T22:01:11.458Z","updated_at":"2025-08-16T22:01:11.458Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284894247,"owners_count":27080670,"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-17T02:00:06.431Z","response_time":55,"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":"2024-08-01T10:01:13.994Z","updated_at":"2025-11-17T14:12:28.139Z","avatar_url":"https://github.com/ankane.png","language":"Ruby","readme":"# Mailkick\n\nEmail subscriptions for Rails\n\n- Add one-click unsubscribe links and headers to your emails\n- Fetch bounces and spam reports from your email service\n\n**Mailkick 2.0 was recently released** - see [how to upgrade](#upgrading)\n\n:postbox: Check out [Ahoy Email](https://github.com/ankane/ahoy_email) for analytics\n\n[![Build Status](https://github.com/ankane/mailkick/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/mailkick/actions)\n\n## Installation\n\nAdd this line to your application’s Gemfile:\n\n```ruby\ngem \"mailkick\"\n```\n\nAnd run the generator. This creates a table to store subscriptions.\n\n```sh\nbundle install\nrails generate mailkick:install\nrails db:migrate\n```\n\n## Getting Started\n\nAdd `has_subscriptions` to your user model:\n\n```ruby\nclass User \u003c ApplicationRecord\n  has_subscriptions\nend\n```\n\nSubscribe to a list\n\n```ruby\nuser.subscribe(\"sales\")\n```\n\nUnsubscribe from a list\n\n```ruby\nuser.unsubscribe(\"sales\")\n```\n\nCheck if subscribed\n\n```ruby\nuser.subscribed?(\"sales\")\n```\n\nGet subscribers for a list (use this for sending emails)\n\n```ruby\nUser.subscribed(\"sales\")\n```\n\n## Unsubscribe Links\n\nAdd an unsubscribe link to your emails. For HTML emails, use:\n\n```erb\n\u003c%= link_to \"Unsubscribe\", mailkick_unsubscribe_url(@user, \"sales\") %\u003e\n```\n\nFor text emails, use:\n\n```erb\nUnsubscribe: \u003c%= mailkick_unsubscribe_url(@user, \"sales\") %\u003e\n```\n\nWhen a user unsubscribes, they are taken to a mobile-friendly page and given the option to resubscribe. To customize the view, run:\n\n```sh\nrails generate mailkick:views\n```\n\nwhich copies the view into `app/views/mailkick`.\n\n## Unsubscribe Headers\n\nFor one-click unsubscribe headers ([RFC 8058](https://datatracker.ietf.org/doc/html/rfc8058)), create `config/initializers/mailkick.rb` with:\n\n```ruby\nMailkick.headers = true\n```\n\nHeaders will automatically be added to emails that call `mailkick_unsubscribe_url`.\n\n## Bounces and Spam Reports\n\nFetch bounces, spam reports, and unsubscribes from your email service. Create `config/initializers/mailkick.rb` with a method to handle opt outs.\n\n```ruby\nMailkick.process_opt_outs_method = lambda do |opt_outs|\n  emails = opt_outs.map { |v| v[:email] }\n  subscribers = User.includes(:mailkick_subscriptions).where(email: emails).index_by(\u0026:email)\n\n  opt_outs.each do |opt_out|\n    subscriber = subscribers[opt_out[:email]]\n    next unless subscriber\n\n    subscriber.mailkick_subscriptions.each do |subscription|\n      subscription.destroy if subscription.created_at \u003c opt_out[:time]\n    end\n  end\nend\n```\n\nAnd run:\n\n```ruby\nMailkick.fetch_opt_outs\n```\n\nThe following services are supported:\n\n- [AWS SES](#aws-ses)\n- [Mailchimp](#mailchimp)\n- [Mailgun](#mailgun)\n- [Mandrill](#mandrill)\n- [Postmark](#postmark)\n- [SendGrid](#sendgrid)\n\n#### AWS SES\n\nAdd the gem\n\n```ruby\ngem \"aws-sdk-sesv2\"\n```\n\nAnd [configure your AWS credentials](https://github.com/aws/aws-sdk-ruby#configuration). Requires `ses:ListSuppressedDestinations` permission.\n\nIf you started using Amazon SES [before November 25, 2019](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-email-suppression-list.html#sending-email-suppression-list-considerations), you have to manually [enable account-level suppression list feature](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_PutAccountSuppressionAttributes.html).\n\n#### Mailchimp\n\nAdd the gem\n\n```ruby\ngem \"gibbon\", \"\u003e= 2\"\n```\n\nAnd set `ENV[\"MAILCHIMP_API_KEY\"]` and `ENV[\"MAILCHIMP_LIST_ID\"]`.\n\n#### Mailgun\n\nAdd the gem\n\n```ruby\ngem \"mailgun-ruby\"\n```\n\nAnd set `ENV[\"MAILGUN_API_KEY\"]`.\n\n#### Mandrill\n\nAdd the gem\n\n```ruby\ngem \"mandrill-api\"\n```\n\nAnd set `ENV[\"MANDRILL_API_KEY\"]`.\n\n#### Postmark\n\nAdd the gem\n\n```ruby\ngem \"postmark\"\n```\n\nAnd set `ENV[\"POSTMARK_API_KEY\"]`.\n\n#### SendGrid\n\nAdd the gem\n\n```ruby\ngem \"sendgrid-ruby\"\n```\n\nAnd set `ENV[\"SENDGRID_API_KEY\"]`. The API key requires only the `Suppressions` permission.\n\n### Advanced\n\nFor more control over services, set them by hand.\n\n```ruby\nMailkick.services = [\n  Mailkick::Service::SendGrid.new(api_key: \"API_KEY\"),\n  Mailkick::Service::Mailchimp.new(api_key: \"API_KEY\", list_id: \"LIST_ID\")\n]\n```\n\n## Reference\n\nAccess the subscription model directly\n\n```ruby\nMailkick::Subscription.all\n```\n\nPrefix method names with `mailkick_`\n\n```ruby\nclass User \u003c ApplicationRecord\n  has_subscriptions prefix: true\nend\n```\n\n## Upgrading\n\n### 2.0\n\nUnsubscribe links created before version 1.1.1 (released January 2023) will no longer work by default. Determine if this is acceptable for your application (for instance, in the US, links must work [for 30 days](https://www.ftc.gov/business-guidance/resources/can-spam-act-compliance-guide-business) after the message is sent). To restore support, [determine the previous secret token](https://github.com/ankane/mailkick/blob/v1.4.0/lib/mailkick/engine.rb#L13-L22) and create an initializer with:\n\n```ruby\nMailkick.message_verifier.rotate(previous_secret_token, serializer: Marshal)\n```\n\nIf fetching bounces, spam reports, and unsubscribes from Postmark, the suppressions API is now used and the default stream has been changed to `broadcast`. To use `outbound`, create an initializer with:\n\n```ruby\nMailkick.services = [Mailkick::Service::Postmark.new(api_key: api_key, stream_id: \"outbound\")]\n```\n\n## History\n\nView the [changelog](https://github.com/ankane/mailkick/blob/master/CHANGELOG.md)\n\n## Contributing\n\nEveryone is encouraged to help improve this project. Here are a few ways you can help:\n\n- [Report bugs](https://github.com/ankane/mailkick/issues)\n- Fix bugs and [submit pull requests](https://github.com/ankane/mailkick/pulls)\n- Write, clarify, or fix documentation\n- Suggest or add new features\n\nTo get started with development and testing:\n\n```sh\ngit clone https://github.com/ankane/mailkick.git\ncd mailkick\nbundle install\nbundle exec rake test\n```\n","funding_links":[],"categories":["others","Ruby","Gems"],"sub_categories":["Articles"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankane%2Fmailkick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankane%2Fmailkick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankane%2Fmailkick/lists"}