Add gem Truemail

Closes #
This commit is contained in:
Alex Sherman 2020-06-03 16:40:13 +05:00
parent ee44dbe4c8
commit 2d89e8124f
3 changed files with 79 additions and 3 deletions

View file

@ -16,6 +16,7 @@ gem 'pg', '1.2.2'
# 1.8 is for Rails < 5.0
gem 'ransack', '~> 2.3'
gem 'validates_email_format_of', '1.6.3' # validates email against RFC 2822 and RFC 3696
gem 'truemail', '~> 1.7' # validates email by regexp, mail server existence and address existence
# 0.7.3 is the latest for Rails 4.2, however, it is absent on Rubygems server
# https://github.com/huacnlee/rails-settings-cached/issues/165
@ -39,7 +40,7 @@ gem 'grape'
# registry specfic
gem 'data_migrate', '~> 6.1'
gem 'isikukood' # for EE-id validation
gem 'simpleidn', '0.0.9' # For punycode
gem 'simpleidn', '0.1.1' # For punycode
gem 'money-rails'
gem 'whenever', '0.9.4', require: false

View file

@ -434,7 +434,8 @@ GEM
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
simpleidn (0.0.9)
simpleidn (0.1.1)
unf (~> 0.1.4)
sinatra (2.0.8.1)
mustermann (~> 1.0)
rack (~> 2.0)
@ -454,6 +455,8 @@ GEM
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.10)
truemail (1.7.1)
simpleidn (~> 0.1.1)
tzinfo (1.2.7)
thread_safe (~> 0.1)
uglifier (4.2.0)
@ -542,7 +545,8 @@ DEPENDENCIES
select2-rails (= 3.5.9.3)
selectize-rails (= 0.12.1)
simplecov (= 0.17.1)
simpleidn (= 0.0.9)
simpleidn (= 0.1.1)
truemail (~> 1.7)
uglifier
validates_email_format_of (= 1.6.3)
webdrivers

View file

@ -0,0 +1,71 @@
require 'truemail'
Truemail.configure do |config|
# Required parameter. Must be an existing email on behalf of which verification will be performed
config.verifier_email = 'info@internet.ee'
# Optional parameter. Must be an existing domain on behalf of which verification will be performed.
# By default verifier domain based on verifier email
# config.verifier_domain = 'internet.ee'
# Optional parameter. You can override default regex pattern
# config.email_pattern = /regex_pattern/
# Optional parameter. You can override default regex pattern
# config.smtp_error_body_pattern = /regex_pattern/
# Optional parameter. Connection timeout is equal to 2 ms by default.
# config.connection_timeout = 1
# Optional parameter. A SMTP server response timeout is equal to 2 ms by default.
# config.response_timeout = 1
# Optional parameter. Total of connection attempts. It is equal to 2 by default.
# This parameter uses in mx lookup timeout error and smtp request (for cases when
# there is one mx server).
config.connection_attempts = 3
# Optional parameter. You can predefine default validation type for
# Truemail.validate('email@email.com') call without with-parameter
# Available validation types: :regex, :mx, :smtp
config.default_validation_type = :smtp
# Optional parameter. You can predefine which type of validation will be used for domains.
# Also you can skip validation by domain. Available validation types: :regex, :mx, :smtp
# This configuration will be used over current or default validation type parameter
# All of validations for 'somedomain.com' will be processed with regex validation only.
# And all of validations for 'otherdomain.com' will be processed with mx validation only.
# It is equal to empty hash by default.
# config.validation_type_for = { 'somedomain.com' => :regex, 'otherdomain.com' => :mx }
# Optional parameter. Validation of email which contains whitelisted domain always will
# return true. Other validations will not processed even if it was defined in validation_type_for
# It is equal to empty array by default.
# config.whitelisted_domains = []
# Optional parameter. With this option Truemail will validate email which contains whitelisted
# domain only, i.e. if domain whitelisted, validation will passed to Regex, MX or SMTP validators.
# Validation of email which not contains whitelisted domain always will return false.
# It is equal false by default.
#config.whitelist_validation = true
# Optional parameter. Validation of email which contains blacklisted domain always will
# return false. Other validations will not processed even if it was defined in validation_type_for
# It is equal to empty array by default.
#config.blacklisted_domains = []
# Optional parameter. This option will provide to use not RFC MX lookup flow.
# It means that MX and Null MX records will be cheked on the DNS validation layer only.
# By default this option is disabled.
# config.not_rfc_mx_lookup_flow = true
# Optional parameter. This option will be parse bodies of SMTP errors. It will be helpful
# if SMTP server does not return an exact answer that the email does not exist
# By default this option is disabled, available for SMTP validation only.
# config.smtp_safe_check = true
# Optional parameter. This option will enable tracking events. You can print tracking events to
# stdout, write to file or both of these. Tracking event by default is :error
# Available tracking event: :all, :unrecognized_error, :recognized_error, :error
# config.logger = { tracking_event: :all, stdout: true, log_absolute_path: '/home/app/log/truemail.log' }
end