Email check before sending

Asked

Viewed 208 times

3

I have the following page http://neilgaiman.com.br/contato/ to contact a website. Sometimes people type in the field e-mail wrong, and it keeps me from answering it. There is a way to check this field, to confirm the existence of this e-mail?

It can be plugin, because I use Wordpress.

  • 1

    There is no way to be sure that an email exists or not, at most test if it has an arroba and a point at least after the arroba. Almost any extra test will mess up possible valid emails (it is full of form and web tutorial that teaches validate in the wrong way). Also, without sending something, you will definitely not know if the email exists. You can even use two password type fields forcing the user to type twice if it’s really important, but it gets a little weird.

  • I was thinking of creating a new email confirmation field. Anyway, can’t you do something, send some test and return? Type that site http://verify-email.org/

  • 1

    These tests are based on the server of the other party "snitching" whether the account exists or not. The problem is that in some situations, the server accepts qq thing and discards later. Also, if the domain in question has an "all pope" account, you will get a valid email, but you may be going to the wrong person.

2 answers

3


You can connect to the server, and issue a VRFY command. Very few servers support this command, but it is intended exactly that. If the server responds with a DSN 2.0.0, there is the user.

VRFY user

You can send a RCPT, and see if the email is rejected.

MAIL FROM:<>

RCPT TO:<user@domain>

If the user does not exist, you will get a DSN 5.1.1. However, just because the email is not rejected does not mean that the user exists. Some server will silently discard requests like this to avoid enumerating its users. Other servers cannot check the user, and have to accept the message independently.

  • The problem is that this feature will only be active on "bad configured" servers, because for security reasons this is the first thing that is disabled in an email server.

  • exactly agree with you @Nilsonuehara but it was the simplest way I found for this

-1

The @Otto response is show; it’s good to check if the account exists. I find the verification with regular expression incomplete/insufficient, although widely used.

One of the validations I use is:

\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

Regular expression tester

This validation is therefore simple. She marries [qualquerString]@[qualquerString]. [qualquerString]

  • So this expression checks the format of the email, this? Ball show, this test the plugin Contact Form 7 that I already use, I need to test the same domain.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.