From Ruby gem to microservice

Truemail
configurable framework agnostic plain Ruby email validator

  • Configurable validator, validate only what you need
  • Minimal runtime dependencies (just 1 eai library)
  • Supporting of internationalized emails (EAI)
  • Whitelist/blacklist validation layers
  • Simple SMTP debugger
  • Event logger
  • JSON serializer

Regex
validation

MX
validation

SMTP
validation

Whitelist/
Blacklist

Truemail
validation
layers

SMTP Validation - session

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 has 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

Truemail
validation
layers

SMTP validation host conditions

  1. should has MX record
  2. should has existing email
  3. should has PTR record for domain from email address
  4. shold has opened 25 port for outgoing connections

App
with Truemail

Mail server

static external IP

Load balancer

App
with Truemail

App
with Truemail

internal IP's

dynamic external IP's

App
with Truemail

Mail server

static external IP
domain
PTR record

Load balancer

App
with Truemail

App
with Truemail

internal IP's

dynamic external IP's

???

domain
PTR record

Truemail as
microservice

Truemail
server

static external IP
domain
PTR record

Load balancer

Mail server

App

App

App

  1. Simple host configuration
  2. Platform agnostic
  3. Fast integration

Rack based web API

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
# docker-compose.yml

version: "3.7"

services:
  truemail:
    image: truemail/truemail-rack:v0.2.4
    ports:
      - 9292:9292
    environment:
      VERIFIER_EMAIL: your_email@example.com
      ACCESS_TOKENS: your_token
    tty: true

Truemail server
lightweight rack based web API dockerized image

64.9M