Haineko - HTTP API into ESMTP
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.
$ bin/hainekoctl start -a libexec/haineko.psgi $ plackup -o '127.0.0.1' -p 2794 -a libexec/haineko.psgi
http://127.0.0.1:2794/submit
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'
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.
/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.
HAINEKO_AUTH
http://127.0.0.1:2794/conf
/conf can be accessed from 127.0.0.1 and display Haineko configuration data as a JSON.
/conf
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.
`pwd`
haineko.cf
HAINEKO_ROOT/etc/haineko.cf
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.cf__
HAINEKO_ROOT/etc
-C /path/to/haineko.cf
bin/hainekoctl
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.
HAINEK_AUTH
'export HAINEKO_AUTH=/path/to/password'
-A
HAINEKO_DEBUG
Haineko runs on debug (development) mode when this variable is set. -d option of bin/hainekoctl turns on debug mode.
-d
https://github.com/azumakuniyuki/Haineko
azumakuniyuki <perl.org [at] azumakuniyuki.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Haineko, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Haineko
CPAN shell
perl -MCPAN -e shell install Haineko
For more information on module installation, please visit the detailed CPAN module installation guide.