forward plain emails to remote sockets, without using SMTP

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

forward plain emails to remote sockets, without using SMTP

Sérgio Freire

Hello,

I would like to configure Postfix in such a way that it would forward emails to a remote TCP server. The remote TCP server does not implement SMTP neither LMTP. It is just a basic  TCP server where I want to receive in the socket just the email content, without any SMTP envelope /commands..

What I like is something like doing “cat email | nc remote_ip remote_port”.

The remote server just knows how to decode emails. It doesn’t implement any protocol.

 

Is this possible somehow?

 

Regards,

Sergio

 

Reply | Threaded
Open this post in threaded view
|

Re: forward plain emails to remote sockets, without using SMTP

Victor Duchovni
On Fri, Jun 27, 2008 at 04:57:52PM +0100, S?rgio Freire wrote:

> Hello,
>
> I would like to configure Postfix in such a way that it would forward emails to a remote TCP server. The remote TCP server does not implement SMTP neither LMTP. It is just a basic  TCP server where I want to receive in the socket just the email content, without any SMTP envelope /commands..
>
> What I like is something like doing "cat email | nc remote_ip remote_port".
>
> The remote server just knows how to decode emails. It doesn't implement any protocol.
>

It can't reliably detect the end of the message, and if the connection dies
mid-transfer, the server can't distinguish connection loss from end of message.

Such a server should not be used.

> Is this possible somehow?

Yes, via pipe(8), but it is a bad idea.

--
        Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:[hidden email]?body=unsubscribe%20postfix-users>

If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.
Reply | Threaded
Open this post in threaded view
|

RE: forward plain emails to remote sockets, without using SMTP

Sérgio Freire
Ok, I think you're right.
LMTP would be a good alternative, even if I am delivering to a remote application (under my control)? I think it's much simpler to implement than SMTP.. right?

Regards,
Sergio

-----Original Message-----
From: Victor Duchovni [mailto:[hidden email]]
Sent: sexta-feira, 27 de Junho de 2008 17:05
To: Sérgio Freire
Cc: [hidden email]
Subject: Re: forward plain emails to remote sockets, without using SMTP

On Fri, Jun 27, 2008 at 04:57:52PM +0100, S?rgio Freire wrote:

> Hello,
>
> I would like to configure Postfix in such a way that it would forward emails to a remote TCP server. The remote TCP server does not implement SMTP neither LMTP. It is just a basic  TCP server where I want to receive in the socket just the email content, without any SMTP envelope /commands..
>
> What I like is something like doing "cat email | nc remote_ip remote_port".
>
> The remote server just knows how to decode emails. It doesn't implement any protocol.
>

It can't reliably detect the end of the message, and if the connection dies
mid-transfer, the server can't distinguish connection loss from end of message.

Such a server should not be used.

> Is this possible somehow?

Yes, via pipe(8), but it is a bad idea.

--
        Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:[hidden email]?body=unsubscribe%20postfix-users>

If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.
Reply | Threaded
Open this post in threaded view
|

Re: forward plain emails to remote sockets, without using SMTP

Victor Duchovni
On Fri, Jun 27, 2008 at 05:06:36PM +0100, S?rgio Freire wrote:

> LMTP would be a good alternative, even if I am delivering to a remote
> application (under my control)? I think it's much simpler to implement
> than SMTP.. right?

Actually the SMTP *protocol* is slightly easier to implement than LMTP,
but if you are accepting mail for *multiple* recipients and performing
separate delivery steps for each one, LMTP can free you of the burden
of queueing the mail. A separate response code for each recipient allows
you try all the deliveries while the client is still connected, and report
separate success/fail results. This way any retries or bounces are the
sending client's responsibility.

So what LMTP simplifies is transaction ownership, not protocol.

--
        Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:[hidden email]?body=unsubscribe%20postfix-users>

If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.