From Ruby gem to microservice
Truemail
configurable framework agnostic plain Ruby email validator/verifier
Regex
validation
MX
validation
SMTP
validation
Whitelist/
Blacklist
validation fails
true
true
validation successful
HELO/EHLO
false
MAILFROM
RCPTTO
Open session
$ nc server.example.com 25
220 server.example.com
$ HELO yourdomain.com
250 server.example.com
$ MAIL FROM: <email@yourdomain.com>
250 2.1.0 <email@yourdomain.com> ok
$ RCPT TO: <target_email@domain.com>
250 2.1.5 <target_email@domain.com> recipient ok
true
false
false
false
$ RCPT TO: <target_email@domain.com>
550 5.7.1 No such user!
should be a real
host address should have a ptr
record (rDNS) to HELO host
$ dig -x 127.0.1.1 # your host WAN IP
127.0.0.1.in-addr.arpa. 7194 IN PTR yourdomain.com.
Regex
validation
MX
validation
SMTP
validation
Whitelist/
Blacklist
SMTP verifier host preconditions
Verifier email should be existing
Verifier domain should be existing and the same as in verifier email)
Verifier domain should refer to verefier host IP address
Verifier domain should have MX records
Verefier host should have PTR record
Verifier host should have opened 25 port for outgoing connections
App
with Truemail
Mail server
static external IP
Load balancer
App
with Truemail
internal IP's
dynamic external IP's
Other
app
App
with Truemail
Mail server
static external IP
domain
PTR record
Load balancer
Other
app
App
with Truemail
internal IP's
dynamic external IP's
domain
PTR record
Truemail
server
App
HTTP/1.1
JSON
Request
Response
curl -i -H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: token" \
http://somehost.com:9292?email=some@email.com
HTTP/1.1 200 OK
Content-Type: application/json
Connection: close
Server: thin
{
"date": "2020-02-26 17:00:56 +0200",
"email": "some@email.com",
"validation_type": "smtp",
"success": true,
"errors": null,
"smtp_debug": null,
"configuration": {
"validation_type_by_domain": null,
"whitelist_validation": false,
"whitelisted_domains": null,
"blacklisted_domains": null,
"smtp_safe_check": false,
"email_pattern": "default gem value",
"smtp_error_body_pattern": "default gem value"
}
}
VERIFIER_EMAIL=e@i.us \
ACCESS_TOKENS=token rackup
Truemail
server
static external IP
domain
PTR record
Load balancer
Mail servers
App
App
App
App repo
Dockerfile repo
DockerHub
App docker image
# docker-compose.yml
version: "3.7"
services:
truemail:
image: truemail/truemail-rack:latest # v0.2.7
ports:
- 9292:9292
environment:
VERIFIER_EMAIL: your_email@example.com
ACCESS_TOKENS: your_token
tty: true