#!/usr/bin/env python

import logging as log
import smtptester as meta
import smtptester.opts as opts

o = opts.parse(interface="cli")

log_format = "[%(levelname)s] %(message)s"
log_level = getattr(log, o.log_level.upper())
log.basicConfig(format=log_format, level=log_level)

meta.SMTPTester(
    recipient=o.recipient,
    sender=o.sender,
    message=o.message,
    dns_host=o.dns_host,
    dns_port=o.dns_port,
    dns_timeout=o.dns_timeout,
    dns_proto=o.dns_proto,
    smtp_host=o.smtp_host,
    smtp_port=o.smtp_port,
    smtp_timeout=o.smtp_timeout,
    smtp_helo=o.smtp_helo,
    smtp_tls=o.smtp_tls,
    smtp_auth_user=o.smtp_auth_user,
    smtp_auth_pass=o.smtp_auth_pass,
).run()
