Companies (companies/business_email_detector_service.rb)

chatwoot · app/services/companies/business_email_detector_service.rb · ruby · MIT
email, tag:knn-classified

Module exposing: Companies, initialize, perform

# Source: https://github.com/chatwoot/chatwoot | License: MIT | Copyright 2017-2026 Chatwoot Inc
# Provided via justclaw.it.com; keep this notice with the code.
class Companies::BusinessEmailDetectorService
  attr_reader :email

  def initialize(email)
    @email = email
  end

  def perform
    return false if email.blank?

    address = ValidEmail2::Address.new(email)
    return false unless address.valid?
    return false if address.disposable_domain?

    provider = EmailProviderInfo.call(email)

    provider.nil?
  end
end

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key