wallix / PEPS

Innovative Open source Email + File sharing
GNU Affero General Public License v3.0
699 stars 109 forks source link

Update smtpin Haraka #69

Closed tiangolo closed 6 years ago

tiangolo commented 8 years ago

Update the smtpin service to allow receiving external mesages. It is currently broken.

This probably would fix #62, #61, #58, #56, #41.

I don't know if this worked before at some point in time, but right now, the Haraka transaction.message_stream is a MessageStream, not a Node ReadStream, so request can't read from it directly.

And the transaction.message_stream expects to be used with .pipe() and write directly to a writable stream, but request can't receive the data because it expects a ReadStream, and then tries to send parts of the modified MessageStream. For example, sending the email message headers as HTTP headers, etc. (It's actually not easy to debug).

I added an intermediary Node PassThrough stream, that the transaction.message_stream can write to and the request can read from. I also removed unnecessary options for the transaction.message_stream that were adding dots (.) to the message (those dots are supposed to be used when connecting Haraka with another email server, MTA, MSA,, etc).

To be able to use the image, debug it and use current Docker "best practices" I updated the Dockerfile. Using an official base image, using the internal container names and updating the parts that depended on the legacy linking system, etc.

If you need more arguments to move from the phusion/baseimage or from the legacy linking system, I can provide them (I just didn't yet here because the "post" would get really long).

hbbio commented 8 years ago

Thanks a lot for your contribution! We'll review shortly.