_ _ _ _
| | | | __ _(_)_ __ ___| | _____
| |_| |/ _` | | '_ \ / _ \ |/ / _ \
| _ | (_| | | | | | __/ < (_) |
|_| |_|\__,_|_|_| |_|\___|_|\_\___/
HTTP API into ESMTP
Haineko is an HTTP API server for sending email from a browser or any HTTP client. It is implemented as a web server based on Plack and relays an email posted by HTTP client as JSON to other SMTP server or external email cloud service.
Haineko runs on the server like following systems which can execute Perl 5.10.1 or later and Plack.
- OpenBSD
- FreeBSD
- NetBSD
- Mac OS X
- Linux
- SendGrid - lib/Haineko/SMTPD/Relay/SendGrid.pm
- Amazon SES - lib/Haineko/SMTPD/Relay/AmazonSES.pm
- Mandrill - lib/Haineko/SMTPD/Relay/Mandrill.pm
- Perl 5.10.1 or later
Haineko relies on:
- Authen::SASL
- Class::Accessor::Lite
- Email::MIME
- Encode (core module from v5.7.3)
- File::Basename (core module from v5)
- IO::File (core module from 5.00307)
- IO::Socket::SSL
- Furl
- JSON::Syck
- Module::Load (core module from v5.9.4)
- Net::SMTP (core module from v5.7.3)
- Net::SMTPS
- Net::CIDR::Lite
- Path::Class
- Plack
- Router::Simple
- Sys::Syslog (core module from v5.0.0)
- Time::Piece (core module from v5.9.5)
- Try::Tiny
Haineko with Basic Authentication at sending an email relies on the following modules:
- Crypt::SaltedHash
- Plack::MiddleWare::Auth::Basic
$ cd /usr/local/src
$ git clone https://github.com/azumakuniyuki/Haineko.git
$ cd ./Haineko
$ sudo cpanm --installdeps .
$ for CF in haineko.cf mailertable sendermt recipients relayhosts authinfo; do
> cp $CF-example $CF
> vi $CF
> done
Run by the one of the followings:
$ plackup -o '127.0.0.1' -p 2794 -a libexec/haineko.psgi
$ cd ./Haineko
$ ./bootstrap
$ sh configure --prefix=/path/to/dir (default=/usr/local/haineko)
$ cpanm -L./dist --installdeps .
OR
$ make depend
$ make && make test && sudo make install
$ cd /usr/local/haineko/etc
$ for CF in haineko.cf mailertable sendermt recipients relayhosts authinfo; do
> sudo cp $CF-example $CF
> sudo vi $CF
> done
$ cd /usr/local/haineko
$ export PERL5LIB=/usr/local/haineko/lib/perl5
Run by the one of the followings:
$ plackup -o '127.0.0.1' -p 2794 -a libexec/haineko.psgi
$ cd ./Haineko
$ sudo cpanm .
$ sudo cpanm -L/usr/local --installdeps .
$ cd /usr/local/etc
$ for CF in haineko.cf mailertable sendermt recipients relayhosts authinfo; do
> sudo cp $CF-example $CF
> sudo vi $CF
> done
Run by the one of the followings:
$ cd /usr/local
$ plackup -o '127.0.0.1' -p 2794 -a libexec/haineko.psgi
$ plackup -o 127.0.0.1 -p 2794 -a libexec/haineko.psgi
$ sbin/hainekod -d -a libexec/haineko.psgi start
When start_server
command (Server::Starter) exists on your system, hainekod script
will use the command as a server program.
Please have a look at the complete format description in each file listed at the followings. These files are read from Haineko as a YAML-formatted file.
Main configuration file for Haineko. If you want to use other configuration file, set $HAINEKO_CONF environment variable like 'export HAINEKO_CONF=/etc/neko.cf'.
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.
Defines "mailer table" which decide the mailer by sender's domain part.
Provide credentials for client side authentication information. Credentials defined in this file are used at relaying an email to external SMTP server.
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.
This file should be set secure permission: The only user who runs haineko server can read this file.
Permitted hosts or network table for relaying via /submit.
Permitted envelope recipients and domains for relaying via /submit.
/conf display Haineko configuration data but it can be accessed from 127.0.0.1
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.
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 sbin/hainekod script.
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 sbin/hainekod script.
Haineko runs on debug(development) mode when this variable is set. -d option of sbin/hainekod turns on debug mode.
Sample codes in each language are available in eg/ directory: Perl, Python Ruby, PHP and shell script.
If you look error messages like following at running configure,
Provide an AUTOCONF_VERSION environment variable, please
aclocal-1.10: autom4te failed with exit status: 127
*** Error code 1
Set AUTOCONF_VERSION environment variable.
$ export AUTOCONF_VERSION=2.60
https://github.com/azumakuniyuki/Haineko
azumakuniyuki
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.