Agora além de usar aquela sua RegEx para verificar se o e-mail foi digitado dentro do padrão, agora você pode o check-if-email-exists para verificar se o mesmo existe, sem enviar nenhum e-mail!
É uma ferramenta muito interessante e fácil de usar .
Para instalar, você precisa de o Rust e p Cargo instalados, além do Git, então rode os comandos:
git clone https://github.com/reacherhq/check-if-email-exists
cd check-if-email-exists
cargo build --release
sudo mv ./target/release/check_if_email_exists /usr/local/bin/
A utilização é muito intuitiva, para mais detalhes rode o comando check_if_email_exists --help
a saída será similar ao conteúdo abaixo:
Amaury <amaurym10@protonmail.com>
Check if an email address exists without sending any email.
USAGE:
check_if_email_exists [FLAGS] [OPTIONS] [TO_EMAIL]
ARGS:
<TO_EMAIL> The email to check
FLAGS:
-h, --help Print help information
--http DEPRECATED. Runs a HTTP server. This option will be removed in v0.9.0
-V, --version Print version information
OPTIONS:
--from-email <FROM_EMAIL>
...
Exemplo básico verificar se o e-mail: oi@tchau.com existe:
check_if_email_exists oi@tchau.com
A saída será em formato JSON:
[
{
"input": "oi@tchau.com",
"is_reachable": "unknown",
"misc": {
"is_disposable": false,
"is_role_account": false
},
"mx": {
"accepts_mail": true,
"records": [
"localhost."
]
},
"smtp": {
"error": {
"type": "SmtpError",
"message": "client: Connection closed"
}
},
"syntax": {
"address": "oi@tchau.com",
"domain": "tchau.com",
"is_valid_syntax": true,
"username": "oi"
}
}
]
Note o elemento: is_role_account”: false , se o e-mail existisse seria true .
Para mais informações consulte o repositório do check-if-email-exists .