SMTP to HTTP gateway
Usage: smtp2http [-v|--verbose] [-s|--silent|-q|--quiet][-T|--tls=<tls_opt>]
Begin listening for incoming SMTP messages, parse them, and post them to the specified HTTP endpoint.
Enable TLS using separate certificate and key files with signing CA cert.
CERT=/etc/private/ssl/example.com.crtKEY=/etc/private/ssl/example.com.keyCA=/etc/private/ssl/example.com-ca.crtsmtp2http -T$CERT:$KEY:$CA https://example.com/foo
Enable TLS using cert and key files only.
CERT=/etc/private/ssl/example.com.crtKEY=/etc/private/ssh/example.com.keysmtp2http -T$CERT:$KEY https://example.com/foo
Enable TLS using single PFX combined cert file.
CERT=/etc/private/ssl/example.com.pfxsmtp2http -T$CERT https://example.com/foo
git clone firstname.lastname@example.org:Zingle/smtp2http.gitcd smtp2httpnpm install -g
The SMTP protocol does not provide any way to set the TCP port used for communication. Because of this, development can be difficult if trying to use public mail providers because you must have an internet facing server listening on port 25.
You can run something like the following to set up a reverse tunnel using a public server to which you have SSH access.
ssh -fNR 25:localhost:2025 email@example.comSMTP_PORT=2025 smtp2http
In this example,
example.com is the public server to which you have access,
root is a user with access to open low-numbered ports on that host,
the port this host will listen on (standard SMTP port), and
2025 is the port
smtp2http will listen on.
If you have a typical PEM cert with separate key and cert files, you may wish to generate a PFX cert which is simple to specify.
openssl pkcs12 -export \-out example.com.pfx \-in example.com.crt -inkey example.com.key \-certfile example.com-ca.crt