Comments (4)
This is working properly for me now. It sounds like your DNS wasn't properly responding, which would explain the long time for response and and the returned errors.
It could also have been a DNS issue at google not returning the correct information. While I have not heard of a recent Google outage, the recent Facebook outage left clients repeatedly hitting public DNS servers like Google's 4.4.4.4 and 8.8.8.8, causing them to suffer service degradation.
Is this still happening? Are you using the most recent version?
We want to use DNS to validate domains as a step to ensure a valid email address, but if you give the host_validation: :syntax
option, it will skip it, as you tried.
There is a configuration dns_timeout
which takes the number of seconds to timeout. Currently, this is not set by the library, but perhaps should be. (See Resolv::DNS.timeout=)
from email_address.
It's still happening on my end today using 0.2.0 and after updating to 0.2.1.
One thing I forgot to mention: it's not consistent. Sometimes validating a Google managed address succeeds; sometimes it fails on the first attempt; sometimes on the second attempt; sometimes on the 8th attempt etc.
I saw dns_timeout
is included in EmailAddress::Config.all_settings
But when I try running:
EmailAddress::Config.setting(:dns_timeout, 5000)
EmailAddress.valid?('[email protected]')
or
EmailAddress.valid?('[email protected]', dns_timeout: 5000)
...it does not reduce the time to fail. Do I need to set it via a different method (using Resolv::DNS)?
from email_address.
The timeout value is in seconds, so try something like 5 instead.
As far as the the inconsistency of validations, it sounds like your DNS service, otherwise other people would be raising this issue as well. Can you change your DNS to use Google (https://developers.google.com/speed/public-dns/docs/using) or Cloudflare (https://beebom.com/how-switch-to-cloudflares-1-1-1-1-dns/) and see if it solves your issue?
from email_address.
Thanks for correcting me on the timeout value - I'm too used to using milliseconds in Javascript!
And for the info on how to change DNS service.
In the end I have just worked around the issue by skipping the DNS check in development:
EmailAddress.valid?(params[:email], Rails.env.development? ? {host_validation: :syntax} : {})
from email_address.
Related Issues (20)
- Still making DNS requests when `dns_lookup` is `off` HOT 3
- Dots in a GSuite domain are not the same as in gmail HOT 2
- EmailAddress validation fail with dns_lookup HOT 1
- Address validation `address_local` not implemented HOT 1
- Period not allowed in tags? HOT 2
- Ruby 3.0.0 deprecation: Socket.gethostbyname is deprecated; use Addrinfo.getaddrinfo instead HOT 1
- Tests fails on current `master` HOT 1
- Go to another CI HOT 1
- Validating common email typos without MX/network lookup, using public suffix gem HOT 1
- EmailAddress.matches?(address, 'google') #=> 'google' (true) Error in Version 0.1.20 HOT 1
- Relaxed is not accepting + character HOT 2
- DNS MX timeout - no error HOT 1
- Valid google address has too short local part HOT 1
- net-smtp gem required with Ruby >= 3.1 HOT 1
- :host_size is Unresponsive
- syntax error, unexpected '.' (SyntaxError) HOT 1
- Gmail address validation on old addresses HOT 2
- Seemingly valid email address marked invalid HOT 5
- Canonical does not remove . HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from email_address.