Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EmailValidator checkMX and checkPort #1246

Closed
2 of 3 tasks
cebe opened this issue Nov 20, 2013 · 6 comments
Closed
2 of 3 tasks

EmailValidator checkMX and checkPort #1246

cebe opened this issue Nov 20, 2013 · 6 comments

Comments

@cebe
Copy link
Member

cebe commented Nov 20, 2013

I'd like to discuss the EmailValidator options checkMX and checkPort.

In the current implementation they are very useless as they do not comply to any standard and will fail on valid email adresses.

checkMX currently checks whether an MX is defined. That's fine as a good DNS setup should involve an MX entry even if the MX server is the same server that the A record of the Domain points to but there is no must have for an MX.

checkPort is completely useless as it currently checks whether port 25 is open on the server that's behind the A record of a domain an not behind the MX. If MX is defined it is very likely that there is no port 25 open on the webserver and no MTA will try to deliver to A record when MX is defined.

We should either drop these options or implement them in a better way.
I propose the following changes:

  • drop checkMX option
  • introduce checkDNSDomain or similar name that checks wether the domain exists in DNS. This is much more useful than checking whether there is MX or not. Note that there is no need for a A record. It should check whether A or MX are defined.
  • if we want to keep checkPort feature it should check for MX and then try all MX ports and if no MX defined, the domain itself. As it may be normal for an MX server to be under load and respond slowly I am not sure if this is a good option to test while rendering a web page though. Default timeout is 30sec afaik so this can slow down validation process significantly.
@qiangxue
Copy link
Member

I'm fine with what you suggested.

cebe added a commit that referenced this issue Nov 20, 2013
@cebe
Copy link
Member Author

cebe commented Nov 20, 2013

I'd personaly vote for removing the checkPort feature as it has the drawbacks described above.
Opinions @yiisoft/core-developers ?

@DaSourcerer
Copy link
Contributor

What about the code in yiisoft/yii#718?

@cebe
Copy link
Member Author

cebe commented Nov 20, 2013

The code would work but it is about the general idea which is bad imo. Even if the MX is down right now because of temporary error the mail could be delivered in an hour for example.
Mailservers are not ment to be always up. An MX has to retry until a given period if a server is currently not available. I consider it save to take down my MX for a few minutes to do maintainance. No user will ever notice.

@DaSourcerer
Copy link
Contributor

Those are excellent points. But I think it should be left to the user to decide if it's worth the risk. Some people want rigid checks and are ok with some "losses."

Having said this, I think nonetheless DNS and port checking could be improved in the way @cebe described.

@cebe
Copy link
Member Author

cebe commented Nov 20, 2013

As I think those people do not understand what they are doing so they are not really okay with the "losses". Will remove the port checking. If someone really wants to do something like that he can extend the validator but we do not encourage this practise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants