From Ruby gem to microservice

Truemail
configurable framework agnostic plain Ruby email validator/verifier

  • Configurable layer-designed validator
  • Minimal runtime dependencies (just 1 eai library)
  • Supporting of internationalized emails (EAI)
  • Whitelist/blacklist validation layers
  • Simple SMTP debugger
  • Event logger
  • Host auditor tools
  • 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 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

Truemail
validation
layers

SMTP verifier host preconditions

  1. Verifier email should be existing

  2. Verifier domain should be existing and the same as in verifier email)

  3. Verifier domain should refer to verefier host IP address

  4. Verifier domain should have MX records

  5. Verefier host should have PTR record

  6. 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 as
microservice

Truemail
server

App

HTTP/1.1


JSON

  1. Lightweight application
  2. Platform agnostic
  3. Fast integration

Requirements

Dockerized Ruby Rack application

Solution

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

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

Truemail server
lightweight rack based web API dockerized image

33.8M

Truemail

Open Source self hosted
email validation/verification solutions

Truemail server

By Vladislav Trotsenko

Truemail server

From Ruby gem to microservice

  • 209
Loading comments...

More from Vladislav Trotsenko