NAME

Haineko - HTTP API into ESMTP

DESCRIPTION

Haineko is a HTTP-API server for sending email. It runs as a web server on port 2794 using Plack.

Haineko stands for HTTP API INTO ESMTP K=undef O=undef, means a gray cat.

SYNOPSIS

$ bin/hainekoctl start -a libexec/haineko.psgi
$ plackup -o '127.0.0.1' -p 2794 -a libexec/haineko.psgi

EMAIL SUBMISSION

URL

http://127.0.0.1:2794/submit

PARAMETERS

To send email via Haineko, POST email data as a JSON format like the following:

{ 
    ehlo: 'your-host-name.as.fqdn'
    mail: 'kijitora@example.jp'
    rcpt: [ 'cats@cat-ml.kyoto.example.jp' ]
    header: { 
        from: 'kijitora <kijitora@example.jp>'
        subject: 'About next meeting'
        relpy-to: 'cats <ml@cat-ml.kyoto.example.jp>'
        charset: 'ISO-2022-JP'
    }
    body: 'Next meeting opens at midnight on next thursday'
}

$ curl 'http://127.0.0.1:2794/submit' -X POST -H 'Content-Type: application/json' \
    -d '{ ehlo: "[127.0.0.1]", mail: "kijitora@example.jp", ... }'

OR

$ curl 'http://127.0.0.1:2794/submit' -X POST -H 'Content-Type application/json' \
    -d '@/path/to/email.json'

CONFIGURATION FILES

These files are read from Haineko as a YAML-formatted file.

etc/haineko.cf

Main configuration file for Haineko.

etc/mailertable

Defines "mailer table": Recipient's domain part based routing table like the same named file in Sendmail. This file is taken precedence over the routing table defined in etc/sendermt for deciding the mailer.

etc/sendermt

Defines "mailer table" which decide the mailer by sender's domain part.

etc/authinfo

Provide credentials for client side authentication information. Credentials defined in this file are used at relaying an email to external SMTP server.

This file should be set secure permission: The only user who runs haineko server can read this file.

etc/relayhosts

Permitted hosts or network table for relaying via /submit.

etc/recipients

Permitted envelope recipients and domains for relaying via /submit.

etc/password

Username and password pairs for basic authentication. Haineko require an username and a password at receiving an email if HAINEKO_AUTH environment variable was set. The value of HAINEKO_AUTH environment variable is the path to password file.

URL

http://127.0.0.1:2794/conf

/conf can be accessed from 127.0.0.1 and display Haineko configuration data as a JSON.

ENVIRONMENT VARIABLES

HAINEKO_ROOT

Haineko decides the root directory by HAINEKO_ROOT or the result of `pwd` command, and read haineko.cf from HAINEKO_ROOT/etc/haineko.cf if HAINEKO_CONF environment variable is not defined.

HAINEKO_CONF

The value of HAINEKO_CONF is the path to __haineko.cf__ file. If this variable is not defined, Haineko finds the file from HAINEKO_ROOT/etc directory. This variable can be set with -C /path/to/haineko.cf at bin/hainekoctl script.

HAINEKO_AUTH

Haineko requires Basic Authentication at connecting Haineko server when HAINEK_AUTH environment variable is set. The value of HAINEKO_AUTH should be the path to the password file such as 'export HAINEKO_AUTH=/path/to/password'. This variable can be set with -A option of bin/hainekoctl script.

HAINEKO_DEBUG

Haineko runs on debug (development) mode when this variable is set. -d option of bin/hainekoctl turns on debug mode.

REPOSITORY

https://github.com/azumakuniyuki/Haineko

AUTHOR

azumakuniyuki <perl.org [at] azumakuniyuki.org>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.