{"id":15145723,"url":"https://github.com/soundcloud/normailize","last_synced_at":"2025-09-29T15:30:59.014Z","repository":{"id":7289727,"uuid":"8605078","full_name":"soundcloud/normailize","owner":"soundcloud","description":"Normalize emails like J.oh.n+sneaky@gmail.com into john@gmail.com","archived":true,"fork":false,"pushed_at":"2019-09-27T11:48:49.000Z","size":11,"stargazers_count":67,"open_issues_count":0,"forks_count":13,"subscribers_count":133,"default_branch":"master","last_synced_at":"2024-12-31T04:18:33.510Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":false,"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/soundcloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-06T14:29:11.000Z","updated_at":"2023-01-28T17:05:17.000Z","dependencies_parsed_at":"2022-09-22T12:36:00.297Z","dependency_job_id":null,"html_url":"https://github.com/soundcloud/normailize","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soundcloud%2Fnormailize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soundcloud%2Fnormailize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soundcloud%2Fnormailize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soundcloud%2Fnormailize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soundcloud","download_url":"https://codeload.github.com/soundcloud/normailize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234634994,"owners_count":18863983,"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":[],"created_at":"2024-09-26T11:42:09.922Z","updated_at":"2025-09-29T15:30:58.677Z","avatar_url":"https://github.com/soundcloud.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Normailize\n\n\u003e **Important notice**: We decided to discontinue support for this project; SoundCloud will no longer accept pull requests or publish new releases. If you're using normailize in one of your projects, we suggest you fork the project in order to perform any necessary maintenance.\n\nNormailize is a gem to normalize email addresses from something like `Jo.Hn+sneaky@gmail.com` to `john@gmail.com`. This can be used in applications to prevent\nspammers and other shady types from signing up multiple times with variations of the same email address by adding dots, mixing the case or adding a plus sign\nfollowed by an arbitrary string.\n\nNormailize currently supports normalizations for the following providers:\n\n - gmail.com (including googlemail.com)\n - live.com\n - hotmail.com\n\nIf an email is given that is not from any of the known providers, it will not do any normalization and only make a simple comparison between two addresses.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'normailize'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install normailize\n\n## Usage\n\n### Comparing two email addresses\n\nThe core of the gem is the `Normailize::EmailAddress#same_as?` which can compare two email addresses and returns true if they normalize into the same address:\n\n```ruby\n# Lets compare two Gmail addresses:\n\naddress1 = Normailize::EmailAddress.new('Jo.Hn+sneaky@gmail.com')\naddress2 = Normailize::EmailAddress.new('j.o.h.n+again@googlemail.com')\n\naddress1.same_as?(address2) # =\u003e True, they both normalize to john and gmail.com and googlemail.com are domains for the same provider\n\n# Now we compare two live.com addresses:\n\naddress1 = Normailize::EmailAddress.new('john@live.com')\naddress2 = Normailize::EmailAddress.new('john+sneaky@live.com')\n\naddress1.same_as?(address2) # =\u003e True, they both normalize to john@live.com\n\n# These are not the same addresses:\n\naddress1 = Normailize::EmailAddress.new('john@somewhere.com')\naddress2 = Normailize::EmailAddress.new('john@somewhereelse.com')\n\naddress1.same_as?(address2) # =\u003e False, they are not the same addresses\n```\n\n### Getting the normalized email address\n\nIf you want to get the normalized email address, you can call the `Normailize::EmailAddress#normalized_address` method:\n\n```ruby\naddress = Normailize::EmailAddress.new('J.oh.N+sNeaky@gmail.com')\naddress.normalized_address # =\u003e john@gmail.com\n```\n\n### Adding a new provider\n\nIf you want to normalize addresses from providers that are not already covered, it's fairly easy to add a new one:\n\n#### Adding a new provider class\n\nThe following is a basic provider for somewhere.com:\n\n```ruby\nmodule Normailize\n  module Provider\n    class Somewhere\n      include Normailize::Provider\n\n      # Specify one or more domains for somewhere.com\n      set_domains 'somewhere.com'\n\n      # Specify modificiations to be done on the username part of the email.\n      # The following modificiations are currently supported:\n      #   - :lowercase          Lowercases the username\n      #   - :remove_dots        Removes all dots\n      #   - :remove_plus_part   Removes everything after the first occurrence of a plus sign\n      set_modifications :lowercase, :remove_plus_part\n    end\n  end\nend\n```\n\nAdapt the Somewhere provider to fit the new provider and save it in the `lib/normailize/providers` directory\n\n#### Registering the new provider\n\nOpen `lib/normailize/provider.rb` and add a switch case in the `Normailize::Provider#factory` method\n\nThis is not perfect and will probably change in the future.\n\n\n## Contributing\n\n1. Fork it\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 new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoundcloud%2Fnormailize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoundcloud%2Fnormailize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoundcloud%2Fnormailize/lists"}