Skip to content

@bestwebua bestwebua released this Apr 28, 2021 · 52 commits to master since this release

MX blacklist layer provides checking extracted mail server(s) IP address from MX validation with predefined blacklisted IP addresses list. It can be used as a part of DEA (disposable email address) validations.

[Whitelist/Blacklist] -> [Regex validation] -> [MX validation] -> [MX blacklist validation]

Example of usage:

require 'truemail'

Truemail.configure do |config|
  config.verifier_email = 'verifier@example.com'
  config.blacklisted_mx_ip_addresses = ['127.0.1.2']
end

Truemail.validate('email@example.com', with: :mx_blacklist)

=> #<Truemail::Validator:0x00007fca0c8aea70
 @result=
  #<struct Truemail::Validator::Result
   success=false,
   email="email@example.com",
   domain="example.com",
   mail_servers=["127.0.1.1", "127.0.1.2"],
   errors={:mx_blacklist=>"blacklisted mx server ip address"},
   smtp_debug=nil,
   configuration=
    #<Truemail::Configuration:0x00007fca0c8aeb38
     @blacklisted_domains=[],
     @blacklisted_mx_ip_addresses=["127.0.1.2"],
     @connection_attempts=2,
     @connection_timeout=2,
     @default_validation_type=:smtp,
     @dns=[],
     @email_pattern=/(?=\A.{6,255}\z)(\A([\p{L}0-9]+[\w|\-.+]*)@((?i-mx:[\p{L}0-9]+([\-.]{1}[\p{L}0-9]+)*\.\p{L}{2,63}))\z)/,
     @not_rfc_mx_lookup_flow=false,
     @response_timeout=2,
     @smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
     @smtp_fail_fast=false,
     @smtp_safe_check=false,
     @validation_type_by_domain={},
     @verifier_domain="example.com",
     @verifier_email="verifier@example.com",
     @whitelist_validation=false,
     @whitelisted_domains=[]>>,
 @validation_type=:mx_blacklist>
  1. Added Truemail::Validate::MxBlacklist, tests
  2. Updated Truemail::Core, tests
  3. Updated Truemail::Configuration, tests
  4. Updated Truemail::Validator
  5. Updated Truemail::Validate::Smtp, tests
  6. Updated Truemail::Log::Serializer::Base, dependent tests
  7. Updated Truemail::Log::Serializer::ValidatorText, tests
  8. Updated gem development dependencies
  9. Updated gem documentation, changelog
  10. Updated gem version to 2.4.0
Assets 2