{"id":13878731,"url":"https://github.com/substancelab/activemodel-email_address_validator","last_synced_at":"2025-07-13T16:32:14.608Z","repository":{"id":28350545,"uuid":"31864211","full_name":"substancelab/activemodel-email_address_validator","owner":"substancelab","description":"Opinionated email address validation for ActiveModels/ActiveRecord","archived":false,"fork":false,"pushed_at":"2024-11-11T04:22:05.000Z","size":80,"stargazers_count":1,"open_issues_count":3,"forks_count":2,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-11-14T13:11:54.414Z","etag":null,"topics":["activemodel","email","validation"],"latest_commit_sha":null,"homepage":null,"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/substancelab.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}},"created_at":"2015-03-08T20:24:05.000Z","updated_at":"2024-06-04T08:58:01.000Z","dependencies_parsed_at":"2024-05-31T11:28:59.302Z","dependency_job_id":"cf41daa0-c42f-43f9-a94c-c4e80d3091fe","html_url":"https://github.com/substancelab/activemodel-email_address_validator","commit_stats":{"total_commits":90,"total_committers":6,"mean_commits":15.0,"dds":0.07777777777777772,"last_synced_commit":"ff482ea54ffa183ccbf9d3f657a92de51a362e96"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substancelab%2Factivemodel-email_address_validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substancelab%2Factivemodel-email_address_validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substancelab%2Factivemodel-email_address_validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substancelab%2Factivemodel-email_address_validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/substancelab","download_url":"https://codeload.github.com/substancelab/activemodel-email_address_validator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225901188,"owners_count":17542183,"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","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":["activemodel","email","validation"],"created_at":"2024-08-06T08:01:57.984Z","updated_at":"2025-07-13T16:32:14.602Z","avatar_url":"https://github.com/substancelab.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Email Address Validator\n## ActiveModel-style email address format validator\n\n[![Code Climate](https://codeclimate.com/github/substancelab/activemodel-email_address_validator/badges/gpa.svg)](https://codeclimate.com/github/substancelab/activemodel-email_address_validator) [![Coverage Status](https://coveralls.io/repos/substancelab/activemodel-email_address_validator/badge.svg?branch=more-badges\u0026service=github)](https://coveralls.io/github/substancelab/activemodel-email_address_validator?branch=more-badges)\n\nWhenever I have wanted to validate an email address it has been because I wanted to be somewhat certain I can send an email to someone. Usually this happens as part of a signup procedure.\n\nAt this point I have pretty much one criteria:\n\n* Don't reject a valid email address realistically in use by a potential user. Err on the side of accepting too much.\n\nQuite frankly, I don't care about the RFC at this point, neither does the user. I care that my users can enter their email address and get on with using my product. I appreciate it if the application catches any misspellings of their email addresses, though - this is the opportune moment for them to correct it.\n\n## Requirements\n\n* Should not accept local email addresses: No user ever needed to sign up using `\"postmaster@localhost\"` or `\"bob@1.2.3.4\"` even though they are perfectly valid email addresses.\n* Must work with I18n like Rails' built-in validators do. If not configured otherwise, the default translation key must be `:invalid`.\n\n## Usage examples\n\n### Simplest case\n\n    validates :email, :email_address =\u003e true\n\n### Bring your own logic\n\nIf the default behavior isn't enough for you, you can include a custom rule for email addresses. For example to match the email addresses against a regular expression:\n\n    validates :email, :email_address =\u003e {:with =\u003e /.+@.+\\..+/}\n\nOr you could go beyound simple matching and validate that all email adresses belong to the same company:\n\n    validates :email, :email_address =\u003e {\n      :with =\u003e proc { |address| address.end_with?(\"@substancelab.com\") }\n    }\n\nYou can even match against multiple rules, in which case all rules must pass:\n\n    validates :email, :email_address =\u003e {\n      :with =\u003e [\n        proc { |address| address.match(/.+@.+\\..+/) },\n        proc { |address| !address.end_with?(\"@outlook.com\") },\n      ]\n    }\n\nDo note that supplying your own rules means that the default email address validation isn't run - you're on your own, basically.\n\n### Verify domain (still to be done - pull request, anybody?)\n\nThis also checks that the domain actually has an MX record. Note this might take a while because of DNS lookups.\n\n    validates :email, :email_address =\u003e {:mx =\u003e true}\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'activemodel-email_address_validator'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install activemodel-email_address_validator\n\n## Resources\n\n* http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address\n* http://davidcel.is/blog/2012/09/06/stop-validating-email-addresses-with-regex/\n* http://blog.myitcv.org.uk/2013/03/14/validators-in-rails-using-email-as-an-example.html\n\n## Other libraries\n\n### Serverside\n\n* https://github.com/balexand/email_validator\n* https://github.com/codyrobbins/active-model-email-validator\n* https://github.com/franckverrot/activevalidators\n* https://github.com/hallelujah/valid_email\n* https://github.com/micke/valid_email2\n* https://github.com/validates-email-format-of/validates_email_format_of\n\n### Clientside\n\n* https://github.com/mailcheck/mailcheck\n\n## Contributing\n\n1. Fork it ( https://github.com/substancelab/activemodel-email_address_validator/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubstancelab%2Factivemodel-email_address_validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsubstancelab%2Factivemodel-email_address_validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubstancelab%2Factivemodel-email_address_validator/lists"}