{"id":15512996,"url":"https://github.com/aldesantis/hertz-email","last_synced_at":"2025-10-08T17:24:51.300Z","repository":{"id":52414946,"uuid":"58304876","full_name":"aldesantis/hertz-email","owner":"aldesantis","description":"A Hertz courier for sending email notifications with ActionMailer.","archived":false,"fork":false,"pushed_at":"2021-04-29T21:00:25.000Z","size":93,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-12T21:24:25.031Z","etag":null,"topics":["email","hertz","notifications","rails","ruby"],"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/aldesantis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-08T09:20:18.000Z","updated_at":"2021-07-14T21:05:20.000Z","dependencies_parsed_at":"2022-08-20T23:10:23.150Z","dependency_job_id":null,"html_url":"https://github.com/aldesantis/hertz-email","commit_stats":null,"previous_names":["alessandro1997/hertz-courier-email"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/aldesantis/hertz-email","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aldesantis%2Fhertz-email","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aldesantis%2Fhertz-email/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aldesantis%2Fhertz-email/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aldesantis%2Fhertz-email/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aldesantis","download_url":"https://codeload.github.com/aldesantis/hertz-email/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aldesantis%2Fhertz-email/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275227367,"owners_count":25427401,"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-09-15T02:00:09.272Z","response_time":75,"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":["email","hertz","notifications","rails","ruby"],"created_at":"2024-10-02T09:54:00.545Z","updated_at":"2025-10-08T17:24:51.232Z","avatar_url":"https://github.com/aldesantis.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hertz::Email\n\n[![Build Status](https://travis-ci.org/aldesantis/hertz-email.svg?branch=master)](https://travis-ci.org/aldesantis/hertz-email)\n[![Coverage Status](https://coveralls.io/repos/github/aldesantis/hertz-email/badge.svg?branch=master)](https://coveralls.io/github/aldesantis/hertz-email?branch=master)\n[![Maintainability](https://api.codeclimate.com/v1/badges/c71c1821b56b288ea71a/maintainability)](https://codeclimate.com/github/aldesantis/hertz-email/maintainability)\n\nThis is a [Hertz](https://github.com/aldesantis/hertz) courier for sending email notifications to \nyour users through ActionMailer.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'hertz-email'\n```\n\nAnd then execute:\n\n```console\n$ bundle\n```\n\nOr install it yourself as:\n\n```console\n$ gem install hertz-email\n```\n\nThen, run the installer generator:\n\n```console\n$ rails g hertz:email:install\n```\n\nYou will also need to expose the `hertz_email` method in your receiver class. This can be either a \nsingle email or an array of emails:\n\n```ruby\nclass User \u003c ActiveRecord::Base\n  include Hertz::Notifiable\n\n  def hertz_email\n    email\n  end\nend\n```\n\nIf `#hertz_email` returns an empty value (i.e. `false`, `nil`, an empty string or an empty array) at \nthe time the job is executed, the notification will not be delivered. This allows you to\nprogrammatically enable/disable email notifications for a user:\n\n```ruby\nclass User\n  include Hertz::Notifiable\n\n  def hertz_email\n    email if email_verified?\n  end\nend\n```\n\nOr even to choose what addresses they can receive emails to:\n\n```ruby\nclass User\n  include Hertz::Notifiable\n\n  def hertz_email\n    emails.select(\u0026:verified?)\n  end\nend\n```\n\n## Usage\n\nIn order to use this courier, add `:email` to `#deliver_by` in the notification model(s):\n\n```ruby\nclass CommentNotification \u003c Hertz::Notification\n  deliver_by :email\nend\n```\n\nNow, add the `#email_subject` method in your notification class:\n\n```ruby\nclass CommentNotification \u003c Hertz::Notification\n  def email_subject\n    'You have a new comment!'\n  end\nend\n```\n\nYou may also pass more options to the `#mail` method of the mailer by defining a `#email_options` \nmethod:\n\n```ruby\nclass CommentNotification \u003c Hertz::Notification\n  def email_options\n    {\n      # generate a custom Reply-To address for the receiver\n      reply_to: \"replies+#{receiver.id}@example.com\" \n    }\n  end\nend\n```\n\nFinally, you should create a template for every notification you send by email. For \n`CommentNotification` you'd create a template at \n`app/views/hertz/email/notification_mailer/comment_notification.html.erb`:\n\n```erb\n\u003cp\u003eHey \u003c%= @notification.receiver.hertz_email %\u003e,\u003c/p\u003e\n\u003cp\u003eyou've got a new comment!\u003c/p\u003e\n```\n\nAs you can see, templates have access to the `@notification` instance variable.\n\n**NOTE:** This courier uses the [deliveries API](https://github.com/alessandro1997/hertz#tracking-delivery-status)\nto prevent double deliveries.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/aldesantis/hertz-email.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faldesantis%2Fhertz-email","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faldesantis%2Fhertz-email","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faldesantis%2Fhertz-email/lists"}