You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mime4j-dev@james.apache.org by Markus Wiederkehr <ma...@gmail.com> on 2009/06/11 16:30:58 UTC

SMTP Transport?

I've written a class SmtpTransport that can be used to send a Mime4j
message to an SMTP server.

Currently it is very simple. Meaning it is not yet capable of
authentication or TLS or other extensions.

Would it be worth to include this code in Mime4j?

Cheers,
Markus

PS: Testing is a bit of a PITA with sockets and all.. Robert, could
MPT help with that? I haven't looked into it yet..

Re: SMTP Transport?

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, Jun 12, 2009 at 01:49:15PM +0200, Markus Wiederkehr wrote:
> On Fri, Jun 12, 2009 at 11:39 AM, Stefano Bagnara<ap...@bago.org> wrote:
> > Oleg Kalnichevski ha scritto:
> >> On Thu, Jun 11, 2009 at 04:30:58PM +0200, Markus Wiederkehr wrote:
> >>> I've written a class SmtpTransport that can be used to send a Mime4j
> >>> message to an SMTP server.
> >>>
> >>> Currently it is very simple. Meaning it is not yet capable of
> >>> authentication or TLS or other extensions.
> >>>
> >>> Would it be worth to include this code in Mime4j?
> >>>
> >>> Cheers,
> >>> Markus
> >>>
> >>> PS: Testing is a bit of a PITA with sockets and all.. Robert, could
> >>> MPT help with that? I haven't looked into it yet..
> >>
> >> Markus et al
> >>
> >> _Coincidentally_, I have been working on a LMTP agent and LMTP client with
> >> support for mandatory extensions required by LMTP [1]: PIPELINING,
> >> ENHANCEDSTATUSCODES and 8BITMIME. The implementation is based a NIO framework
> >> derived from HttpCore NIO and should be quite scalable. This is my private
> >> project, but if there is interest in such work, I am willing to contribute it
> >> to James. Alternatively you are very welcome to contribute to the effort. It is
> >> ASLv2 licensed.
> >>
> >> Cheers
> >>
> >> Oleg
> >>
> >> [1] http://www.ietf.org/rfc/rfc2033.txt
> >
> > I'm interested in email client, too.
> >
> > But I'm against putting this stuff in mime4j. A new JAMES sub-project
> > (product) would be a better place.
> 
> Why not start with a Mime4j module?
> 
> Later it can become an independent product. That product would have to
> have a Mime4j-submodule though because I'd like to have that
> higher-level API that accepts a Mime4j message and extracts sender and
> recipient addresses from it, too.
> 
> > I'd like to see the sources to understand if it is something I will be
> > interested in collaborating. I wrote a NIO SMTP client, too :-) (MINA).
> 

Hi Markus

> Out of curiosity, how do filter a stream with NIO? (Canonical CRLFs,
> escape dots at the beginning of a line.)

Using a fairly simple session input buffer:

http://code.google.com/p/lightnio/source/browse/trunk/src/main/java/com/ok2c/lightnio/SessionInputBuffer.java
http://code.google.com/p/lightnio/source/browse/trunk/src/main/java/com/ok2c/lightnio/impl/SessionInputBufferImpl.java#126

> A Mime4j message has a writeTo(OutputStream) method.. What would have
> to be done on that side? Add a writeTo(WritableByteChannel) method?

For my personal use I am perfectly fine with streaming message body to a temp
file using NIO (NIO can be very efficient at that, specially using direct
transfer methods) and then processing it with mime4j using classic (blocking
i/o)

> And is it worth it? I mean I've never had performance problems with
> JavaMail's transport which is stream based..

Contrary to popular belief NIO is _significantly_ slower than class i/o in
terms of raw throughput. Actually NIO makes no sense of what so ever for SMTP
clients. Having said that, my primary objective is an LMTP agent, where NIO
does make sense. It is quite suboptimal to have an I/O thread blocked waiting
for a result of a content filtering operation. So, some kind of event driven
protocol layer would make sense, and event-driven architectures are simpler
with NIO. SMTP client is merely a byproduct for me. I simply want to be able to
unit test my code using the same transport / protocol code. Client side LMTP
is virtually identical to client side SMPT, so I should get an SMTP client
implementation basically for free.

Oleg 


> Markus
> 
> > Stefano

Re: SMTP Transport?

Posted by Markus Wiederkehr <ma...@gmail.com>.
On Fri, Jun 12, 2009 at 11:39 AM, Stefano Bagnara<ap...@bago.org> wrote:
> Oleg Kalnichevski ha scritto:
>> On Thu, Jun 11, 2009 at 04:30:58PM +0200, Markus Wiederkehr wrote:
>>> I've written a class SmtpTransport that can be used to send a Mime4j
>>> message to an SMTP server.
>>>
>>> Currently it is very simple. Meaning it is not yet capable of
>>> authentication or TLS or other extensions.
>>>
>>> Would it be worth to include this code in Mime4j?
>>>
>>> Cheers,
>>> Markus
>>>
>>> PS: Testing is a bit of a PITA with sockets and all.. Robert, could
>>> MPT help with that? I haven't looked into it yet..
>>
>> Markus et al
>>
>> _Coincidentally_, I have been working on a LMTP agent and LMTP client with
>> support for mandatory extensions required by LMTP [1]: PIPELINING,
>> ENHANCEDSTATUSCODES and 8BITMIME. The implementation is based a NIO framework
>> derived from HttpCore NIO and should be quite scalable. This is my private
>> project, but if there is interest in such work, I am willing to contribute it
>> to James. Alternatively you are very welcome to contribute to the effort. It is
>> ASLv2 licensed.
>>
>> Cheers
>>
>> Oleg
>>
>> [1] http://www.ietf.org/rfc/rfc2033.txt
>
> I'm interested in email client, too.
>
> But I'm against putting this stuff in mime4j. A new JAMES sub-project
> (product) would be a better place.

Why not start with a Mime4j module?

Later it can become an independent product. That product would have to
have a Mime4j-submodule though because I'd like to have that
higher-level API that accepts a Mime4j message and extracts sender and
recipient addresses from it, too.

> I'd like to see the sources to understand if it is something I will be
> interested in collaborating. I wrote a NIO SMTP client, too :-) (MINA).

Out of curiosity, how do filter a stream with NIO? (Canonical CRLFs,
escape dots at the beginning of a line.)

A Mime4j message has a writeTo(OutputStream) method.. What would have
to be done on that side? Add a writeTo(WritableByteChannel) method?

And is it worth it? I mean I've never had performance problems with
JavaMail's transport which is stream based..

Markus

> Stefano

Re: SMTP Transport?

Posted by Stefano Bagnara <ap...@bago.org>.
Oleg Kalnichevski ha scritto:
> On Thu, Jun 11, 2009 at 04:30:58PM +0200, Markus Wiederkehr wrote:
>> I've written a class SmtpTransport that can be used to send a Mime4j
>> message to an SMTP server.
>>
>> Currently it is very simple. Meaning it is not yet capable of
>> authentication or TLS or other extensions.
>>
>> Would it be worth to include this code in Mime4j?
>>
>> Cheers,
>> Markus
>>
>> PS: Testing is a bit of a PITA with sockets and all.. Robert, could
>> MPT help with that? I haven't looked into it yet..
> 
> Markus et al
> 
> _Coincidentally_, I have been working on a LMTP agent and LMTP client with
> support for mandatory extensions required by LMTP [1]: PIPELINING,
> ENHANCEDSTATUSCODES and 8BITMIME. The implementation is based a NIO framework
> derived from HttpCore NIO and should be quite scalable. This is my private
> project, but if there is interest in such work, I am willing to contribute it
> to James. Alternatively you are very welcome to contribute to the effort. It is
> ASLv2 licensed.
> 
> Cheers
> 
> Oleg
> 
> [1] http://www.ietf.org/rfc/rfc2033.txt

I'm interested in email client, too.

But I'm against putting this stuff in mime4j. A new JAMES sub-project
(product) would be a better place.

I'd like to see the sources to understand if it is something I will be
interested in collaborating. I wrote a NIO SMTP client, too :-) (MINA).

Stefano

Re: SMTP Transport?

Posted by Oleg Kalnichevski <ol...@apache.org>.
Norman Maurer wrote:
> Hi Oleg,
> 
> no need to be sorry ;) Anyway I thought more of writing lmtp protocol
> implementation which not depends on any nio framework directly. Just
> like the smtp-protocol-library (in james server trunk). The protocol
> should be independent of the transport. So the protocol should be
> usable with "every" transport framework.
> 
> So at the moment we have a mina-socket-library but the
> smtp-protocol-library would also work with (for example)
> lightnio-socket-library ;)
> 

That would truly be the best case scenario, but I doubt this can be done 
without a significant loss of efficiency. I was not able to do that for 
our HTTP transport. It is worth a try, though.

Anyhow, feel free to re-use whatever bits of my code you may find useful.

I would be so happy to deprecate my stuff in favor of something backed 
by a larger community.

Cheers

Oleg


> Bye,
> Norman
> 
> 2010/1/30 Oleg Kalnichevski <ol...@apache.org>:
>> Norman Maurer wrote:
>>> Hi Oleg,
>>>
>>> sorry for takin so long but I had many other stuff on my blade. I
>>> would really like to get a LMTP implementation into james (using MINA
>>> for NIO), is there any interest in this for you ?
>>>
>> Hi Norman
>>
>> I am sorry to say what I am about to say, but, if using MINA, no, there
>> would be no interest on my part. I took a very close look at MINA internals
>> some time ago, and while there were some really great design ideas in MINA,
>> I personally found its memory management flawed to a point making it
>> unsuitable for data intensive protocols, such as HTTP and SMTP. This is one
>> of the reasons why we opted for writing our own NIO framework for HttpCore.
>> There were other reasons as well.
>>
>> Having written a NIO framework of my own, I fully admit being biased about
>> the issue, though.
>>
>> Sorry.
>>
>> Oleg
>>
>>
>>
>>> Bye,
>>> Norman
>>>
>>> 2009/11/23 Norman Maurer <no...@googlemail.com>:
>>>> Hi Oleg,
>>>>
>>>> I will have a look soon. Thx for keeping us in the loop :)
>>>>
>>>> Bye,
>>>> Norman
>>>>
>>>> 2009/11/23 Oleg Kalnichevski <ol...@apache.org>:
>>>>> Norman Maurer wrote:
>>>>>> Hi Oleg,
>>>>>>
>>>>>> I would be very interested in this :-)
>>>>>>
>>>>>> Bye,
>>>>>> Norman
>>>>>>
>>>>> Folks,
>>>>>
>>>>> I finally have the library in a fairly usable (or shall I rather say
>>>>> testable) state. I can now send messages to the postfix daemon using my
>>>>> SMTP
>>>>> client transport and have the messages passed onto the local LMTP agent
>>>>> based on the same transport code for local delivery.
>>>>>
>>>>> In essence I have a reasonably complete SMTP/LMTP transport library that
>>>>> implements RFC 2821 (minimum implementation), RFC 2033, plus a number of
>>>>> extensions required by LMTP: RFC 2034 (ENHANCEDSTATUSCODES), RFC 1854
>>>>> (PIPELINING), RFC 1652 (8BITMIME).
>>>>>
>>>>> The code is still very experimental but good enough for getting the feel
>>>>> of
>>>>> the API.
>>>>>
>>>>> Here's the sample of the LMTP transfer agent
>>>>>
>>>>>
>>>>> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/LocalMailServerTransportExample.java
>>>>>
>>>>> Envelop validation / message delivery can be fully asynchronous. Long
>>>>> running processes such as DB or LDAP queries can be executed without
>>>>> blocking the I/O transport.
>>>>>
>>>>> The client side transport can either be event (callback) driven
>>>>>
>>>>>
>>>>> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/LocalMailClientTransportExample.java
>>>>>
>>>>> or future driven
>>>>>
>>>>>
>>>>> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/MailUserAgentExample.java
>>>>>
>>>>> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/SendMailExample.java
>>>>>
>>>>> The mail user agent can maintain a pool of persistent connections that
>>>>> can
>>>>> be reused for subsequent delivery requests.
>>>>>
>>>>> The NIO framework is basically a fork of Apache HttpCore with all HTTP
>>>>> dependencies removed.
>>>>>
>>>>> http://code.google.com/p/lightnio/
>>>>>
>>>>> You would have to get the latest snapshots of both libraries in order to
>>>>> run
>>>>> samples.
>>>>>
>>>>> I developed this code for my private use. If you do not think this is
>>>>> something that can be potentially useful for a larger user base, just
>>>>> ignore
>>>>> my message.
>>>>>
>>>>> Cheers
>>>>>
>>>>> Oleg
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> 2009/6/12 Oleg Kalnichevski <ol...@apache.org>:
>>>>>>> On Thu, Jun 11, 2009 at 04:30:58PM +0200, Markus Wiederkehr wrote:
>>>>>>>> I've written a class SmtpTransport that can be used to send a Mime4j
>>>>>>>> message to an SMTP server.
>>>>>>>>
>>>>>>>> Currently it is very simple. Meaning it is not yet capable of
>>>>>>>> authentication or TLS or other extensions.
>>>>>>>>
>>>>>>>> Would it be worth to include this code in Mime4j?
>>>>>>>>
>>>>>>>> Cheers,
>>>>>>>> Markus
>>>>>>>>
>>>>>>>> PS: Testing is a bit of a PITA with sockets and all.. Robert, could
>>>>>>>> MPT help with that? I haven't looked into it yet..
>>>>>>> Markus et al
>>>>>>>
>>>>>>> _Coincidentally_, I have been working on a LMTP agent and LMTP client
>>>>>>> with
>>>>>>> support for mandatory extensions required by LMTP [1]: PIPELINING,
>>>>>>> ENHANCEDSTATUSCODES and 8BITMIME. The implementation is based a NIO
>>>>>>> framework
>>>>>>> derived from HttpCore NIO and should be quite scalable. This is my
>>>>>>> private
>>>>>>> project, but if there is interest in such work, I am willing to
>>>>>>> contribute it
>>>>>>> to James. Alternatively you are very welcome to contribute to the
>>>>>>> effort.
>>>>>>> It is
>>>>>>> ASLv2 licensed.
>>>>>>>
>>>>>>> Cheers
>>>>>>>
>>>>>>> Oleg
>>>>>>>
>>>>>>> [1] http://www.ietf.org/rfc/rfc2033.txt
>>>>>>>
>>>>>>>
>>>>>>>
>>
> 


Re: SMTP Transport?

Posted by Stefano Bagnara <ap...@bago.org>.
2010/1/30 Norman Maurer <no...@googlemail.com>:
> Hi Oleg,
>
> no need to be sorry ;) Anyway I thought more of writing lmtp protocol
> implementation which not depends on any nio framework directly. Just
> like the smtp-protocol-library (in james server trunk). The protocol
> should be independent of the transport. So the protocol should be
> usable with "every" transport framework.

+1

> So at the moment we have a mina-socket-library but the
> smtp-protocol-library would also work with (for example)
> lightnio-socket-library ;)

Too many NIO frameworks.. it's time for commons-nio or sniof4j ;-)

Stefano

Re: SMTP Transport?

Posted by Norman Maurer <no...@googlemail.com>.
Hi Oleg,

no need to be sorry ;) Anyway I thought more of writing lmtp protocol
implementation which not depends on any nio framework directly. Just
like the smtp-protocol-library (in james server trunk). The protocol
should be independent of the transport. So the protocol should be
usable with "every" transport framework.

So at the moment we have a mina-socket-library but the
smtp-protocol-library would also work with (for example)
lightnio-socket-library ;)

Bye,
Norman

2010/1/30 Oleg Kalnichevski <ol...@apache.org>:
> Norman Maurer wrote:
>>
>> Hi Oleg,
>>
>> sorry for takin so long but I had many other stuff on my blade. I
>> would really like to get a LMTP implementation into james (using MINA
>> for NIO), is there any interest in this for you ?
>>
>
> Hi Norman
>
> I am sorry to say what I am about to say, but, if using MINA, no, there
> would be no interest on my part. I took a very close look at MINA internals
> some time ago, and while there were some really great design ideas in MINA,
> I personally found its memory management flawed to a point making it
> unsuitable for data intensive protocols, such as HTTP and SMTP. This is one
> of the reasons why we opted for writing our own NIO framework for HttpCore.
> There were other reasons as well.
>
> Having written a NIO framework of my own, I fully admit being biased about
> the issue, though.
>
> Sorry.
>
> Oleg
>
>
>
>> Bye,
>> Norman
>>
>> 2009/11/23 Norman Maurer <no...@googlemail.com>:
>>>
>>> Hi Oleg,
>>>
>>> I will have a look soon. Thx for keeping us in the loop :)
>>>
>>> Bye,
>>> Norman
>>>
>>> 2009/11/23 Oleg Kalnichevski <ol...@apache.org>:
>>>>
>>>> Norman Maurer wrote:
>>>>>
>>>>> Hi Oleg,
>>>>>
>>>>> I would be very interested in this :-)
>>>>>
>>>>> Bye,
>>>>> Norman
>>>>>
>>>> Folks,
>>>>
>>>> I finally have the library in a fairly usable (or shall I rather say
>>>> testable) state. I can now send messages to the postfix daemon using my
>>>> SMTP
>>>> client transport and have the messages passed onto the local LMTP agent
>>>> based on the same transport code for local delivery.
>>>>
>>>> In essence I have a reasonably complete SMTP/LMTP transport library that
>>>> implements RFC 2821 (minimum implementation), RFC 2033, plus a number of
>>>> extensions required by LMTP: RFC 2034 (ENHANCEDSTATUSCODES), RFC 1854
>>>> (PIPELINING), RFC 1652 (8BITMIME).
>>>>
>>>> The code is still very experimental but good enough for getting the feel
>>>> of
>>>> the API.
>>>>
>>>> Here's the sample of the LMTP transfer agent
>>>>
>>>>
>>>> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/LocalMailServerTransportExample.java
>>>>
>>>> Envelop validation / message delivery can be fully asynchronous. Long
>>>> running processes such as DB or LDAP queries can be executed without
>>>> blocking the I/O transport.
>>>>
>>>> The client side transport can either be event (callback) driven
>>>>
>>>>
>>>> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/LocalMailClientTransportExample.java
>>>>
>>>> or future driven
>>>>
>>>>
>>>> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/MailUserAgentExample.java
>>>>
>>>> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/SendMailExample.java
>>>>
>>>> The mail user agent can maintain a pool of persistent connections that
>>>> can
>>>> be reused for subsequent delivery requests.
>>>>
>>>> The NIO framework is basically a fork of Apache HttpCore with all HTTP
>>>> dependencies removed.
>>>>
>>>> http://code.google.com/p/lightnio/
>>>>
>>>> You would have to get the latest snapshots of both libraries in order to
>>>> run
>>>> samples.
>>>>
>>>> I developed this code for my private use. If you do not think this is
>>>> something that can be potentially useful for a larger user base, just
>>>> ignore
>>>> my message.
>>>>
>>>> Cheers
>>>>
>>>> Oleg
>>>>
>>>>
>>>>
>>>>
>>>>> 2009/6/12 Oleg Kalnichevski <ol...@apache.org>:
>>>>>>
>>>>>> On Thu, Jun 11, 2009 at 04:30:58PM +0200, Markus Wiederkehr wrote:
>>>>>>>
>>>>>>> I've written a class SmtpTransport that can be used to send a Mime4j
>>>>>>> message to an SMTP server.
>>>>>>>
>>>>>>> Currently it is very simple. Meaning it is not yet capable of
>>>>>>> authentication or TLS or other extensions.
>>>>>>>
>>>>>>> Would it be worth to include this code in Mime4j?
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Markus
>>>>>>>
>>>>>>> PS: Testing is a bit of a PITA with sockets and all.. Robert, could
>>>>>>> MPT help with that? I haven't looked into it yet..
>>>>>>
>>>>>> Markus et al
>>>>>>
>>>>>> _Coincidentally_, I have been working on a LMTP agent and LMTP client
>>>>>> with
>>>>>> support for mandatory extensions required by LMTP [1]: PIPELINING,
>>>>>> ENHANCEDSTATUSCODES and 8BITMIME. The implementation is based a NIO
>>>>>> framework
>>>>>> derived from HttpCore NIO and should be quite scalable. This is my
>>>>>> private
>>>>>> project, but if there is interest in such work, I am willing to
>>>>>> contribute it
>>>>>> to James. Alternatively you are very welcome to contribute to the
>>>>>> effort.
>>>>>> It is
>>>>>> ASLv2 licensed.
>>>>>>
>>>>>> Cheers
>>>>>>
>>>>>> Oleg
>>>>>>
>>>>>> [1] http://www.ietf.org/rfc/rfc2033.txt
>>>>>>
>>>>>>
>>>>>>
>>>>
>>
>
>

Re: SMTP Transport?

Posted by Oleg Kalnichevski <ol...@apache.org>.
Norman Maurer wrote:
> Hi Oleg,
> 
> sorry for takin so long but I had many other stuff on my blade. I
> would really like to get a LMTP implementation into james (using MINA
> for NIO), is there any interest in this for you ?
> 

Hi Norman

I am sorry to say what I am about to say, but, if using MINA, no, there 
would be no interest on my part. I took a very close look at MINA 
internals some time ago, and while there were some really great design 
ideas in MINA, I personally found its memory management flawed to a 
point making it unsuitable for data intensive protocols, such as HTTP 
and SMTP. This is one of the reasons why we opted for writing our own 
NIO framework for HttpCore. There were other reasons as well.

Having written a NIO framework of my own, I fully admit being biased 
about the issue, though.

Sorry.

Oleg



> Bye,
> Norman
> 
> 2009/11/23 Norman Maurer <no...@googlemail.com>:
>> Hi Oleg,
>>
>> I will have a look soon. Thx for keeping us in the loop :)
>>
>> Bye,
>> Norman
>>
>> 2009/11/23 Oleg Kalnichevski <ol...@apache.org>:
>>> Norman Maurer wrote:
>>>> Hi Oleg,
>>>>
>>>> I would be very interested in this :-)
>>>>
>>>> Bye,
>>>> Norman
>>>>
>>> Folks,
>>>
>>> I finally have the library in a fairly usable (or shall I rather say
>>> testable) state. I can now send messages to the postfix daemon using my SMTP
>>> client transport and have the messages passed onto the local LMTP agent
>>> based on the same transport code for local delivery.
>>>
>>> In essence I have a reasonably complete SMTP/LMTP transport library that
>>> implements RFC 2821 (minimum implementation), RFC 2033, plus a number of
>>> extensions required by LMTP: RFC 2034 (ENHANCEDSTATUSCODES), RFC 1854
>>> (PIPELINING), RFC 1652 (8BITMIME).
>>>
>>> The code is still very experimental but good enough for getting the feel of
>>> the API.
>>>
>>> Here's the sample of the LMTP transfer agent
>>>
>>> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/LocalMailServerTransportExample.java
>>>
>>> Envelop validation / message delivery can be fully asynchronous. Long
>>> running processes such as DB or LDAP queries can be executed without
>>> blocking the I/O transport.
>>>
>>> The client side transport can either be event (callback) driven
>>>
>>> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/LocalMailClientTransportExample.java
>>>
>>> or future driven
>>>
>>> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/MailUserAgentExample.java
>>> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/SendMailExample.java
>>>
>>> The mail user agent can maintain a pool of persistent connections that can
>>> be reused for subsequent delivery requests.
>>>
>>> The NIO framework is basically a fork of Apache HttpCore with all HTTP
>>> dependencies removed.
>>>
>>> http://code.google.com/p/lightnio/
>>>
>>> You would have to get the latest snapshots of both libraries in order to run
>>> samples.
>>>
>>> I developed this code for my private use. If you do not think this is
>>> something that can be potentially useful for a larger user base, just ignore
>>> my message.
>>>
>>> Cheers
>>>
>>> Oleg
>>>
>>>
>>>
>>>
>>>> 2009/6/12 Oleg Kalnichevski <ol...@apache.org>:
>>>>> On Thu, Jun 11, 2009 at 04:30:58PM +0200, Markus Wiederkehr wrote:
>>>>>> I've written a class SmtpTransport that can be used to send a Mime4j
>>>>>> message to an SMTP server.
>>>>>>
>>>>>> Currently it is very simple. Meaning it is not yet capable of
>>>>>> authentication or TLS or other extensions.
>>>>>>
>>>>>> Would it be worth to include this code in Mime4j?
>>>>>>
>>>>>> Cheers,
>>>>>> Markus
>>>>>>
>>>>>> PS: Testing is a bit of a PITA with sockets and all.. Robert, could
>>>>>> MPT help with that? I haven't looked into it yet..
>>>>> Markus et al
>>>>>
>>>>> _Coincidentally_, I have been working on a LMTP agent and LMTP client
>>>>> with
>>>>> support for mandatory extensions required by LMTP [1]: PIPELINING,
>>>>> ENHANCEDSTATUSCODES and 8BITMIME. The implementation is based a NIO
>>>>> framework
>>>>> derived from HttpCore NIO and should be quite scalable. This is my
>>>>> private
>>>>> project, but if there is interest in such work, I am willing to
>>>>> contribute it
>>>>> to James. Alternatively you are very welcome to contribute to the effort.
>>>>> It is
>>>>> ASLv2 licensed.
>>>>>
>>>>> Cheers
>>>>>
>>>>> Oleg
>>>>>
>>>>> [1] http://www.ietf.org/rfc/rfc2033.txt
>>>>>
>>>>>
>>>>>
>>>
> 


Re: SMTP Transport?

Posted by Norman Maurer <no...@googlemail.com>.
Hi Oleg,

sorry for takin so long but I had many other stuff on my blade. I
would really like to get a LMTP implementation into james (using MINA
for NIO), is there any interest in this for you ?

Bye,
Norman

2009/11/23 Norman Maurer <no...@googlemail.com>:
> Hi Oleg,
>
> I will have a look soon. Thx for keeping us in the loop :)
>
> Bye,
> Norman
>
> 2009/11/23 Oleg Kalnichevski <ol...@apache.org>:
>> Norman Maurer wrote:
>>>
>>> Hi Oleg,
>>>
>>> I would be very interested in this :-)
>>>
>>> Bye,
>>> Norman
>>>
>>
>> Folks,
>>
>> I finally have the library in a fairly usable (or shall I rather say
>> testable) state. I can now send messages to the postfix daemon using my SMTP
>> client transport and have the messages passed onto the local LMTP agent
>> based on the same transport code for local delivery.
>>
>> In essence I have a reasonably complete SMTP/LMTP transport library that
>> implements RFC 2821 (minimum implementation), RFC 2033, plus a number of
>> extensions required by LMTP: RFC 2034 (ENHANCEDSTATUSCODES), RFC 1854
>> (PIPELINING), RFC 1652 (8BITMIME).
>>
>> The code is still very experimental but good enough for getting the feel of
>> the API.
>>
>> Here's the sample of the LMTP transfer agent
>>
>> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/LocalMailServerTransportExample.java
>>
>> Envelop validation / message delivery can be fully asynchronous. Long
>> running processes such as DB or LDAP queries can be executed without
>> blocking the I/O transport.
>>
>> The client side transport can either be event (callback) driven
>>
>> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/LocalMailClientTransportExample.java
>>
>> or future driven
>>
>> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/MailUserAgentExample.java
>> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/SendMailExample.java
>>
>> The mail user agent can maintain a pool of persistent connections that can
>> be reused for subsequent delivery requests.
>>
>> The NIO framework is basically a fork of Apache HttpCore with all HTTP
>> dependencies removed.
>>
>> http://code.google.com/p/lightnio/
>>
>> You would have to get the latest snapshots of both libraries in order to run
>> samples.
>>
>> I developed this code for my private use. If you do not think this is
>> something that can be potentially useful for a larger user base, just ignore
>> my message.
>>
>> Cheers
>>
>> Oleg
>>
>>
>>
>>
>>> 2009/6/12 Oleg Kalnichevski <ol...@apache.org>:
>>>>
>>>> On Thu, Jun 11, 2009 at 04:30:58PM +0200, Markus Wiederkehr wrote:
>>>>>
>>>>> I've written a class SmtpTransport that can be used to send a Mime4j
>>>>> message to an SMTP server.
>>>>>
>>>>> Currently it is very simple. Meaning it is not yet capable of
>>>>> authentication or TLS or other extensions.
>>>>>
>>>>> Would it be worth to include this code in Mime4j?
>>>>>
>>>>> Cheers,
>>>>> Markus
>>>>>
>>>>> PS: Testing is a bit of a PITA with sockets and all.. Robert, could
>>>>> MPT help with that? I haven't looked into it yet..
>>>>
>>>> Markus et al
>>>>
>>>> _Coincidentally_, I have been working on a LMTP agent and LMTP client
>>>> with
>>>> support for mandatory extensions required by LMTP [1]: PIPELINING,
>>>> ENHANCEDSTATUSCODES and 8BITMIME. The implementation is based a NIO
>>>> framework
>>>> derived from HttpCore NIO and should be quite scalable. This is my
>>>> private
>>>> project, but if there is interest in such work, I am willing to
>>>> contribute it
>>>> to James. Alternatively you are very welcome to contribute to the effort.
>>>> It is
>>>> ASLv2 licensed.
>>>>
>>>> Cheers
>>>>
>>>> Oleg
>>>>
>>>> [1] http://www.ietf.org/rfc/rfc2033.txt
>>>>
>>>>
>>>>
>>
>>
>

Re: SMTP Transport?

Posted by Norman Maurer <no...@googlemail.com>.
Hi Oleg,

I will have a look soon. Thx for keeping us in the loop :)

Bye,
Norman

2009/11/23 Oleg Kalnichevski <ol...@apache.org>:
> Norman Maurer wrote:
>>
>> Hi Oleg,
>>
>> I would be very interested in this :-)
>>
>> Bye,
>> Norman
>>
>
> Folks,
>
> I finally have the library in a fairly usable (or shall I rather say
> testable) state. I can now send messages to the postfix daemon using my SMTP
> client transport and have the messages passed onto the local LMTP agent
> based on the same transport code for local delivery.
>
> In essence I have a reasonably complete SMTP/LMTP transport library that
> implements RFC 2821 (minimum implementation), RFC 2033, plus a number of
> extensions required by LMTP: RFC 2034 (ENHANCEDSTATUSCODES), RFC 1854
> (PIPELINING), RFC 1652 (8BITMIME).
>
> The code is still very experimental but good enough for getting the feel of
> the API.
>
> Here's the sample of the LMTP transfer agent
>
> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/LocalMailServerTransportExample.java
>
> Envelop validation / message delivery can be fully asynchronous. Long
> running processes such as DB or LDAP queries can be executed without
> blocking the I/O transport.
>
> The client side transport can either be event (callback) driven
>
> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/LocalMailClientTransportExample.java
>
> or future driven
>
> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/MailUserAgentExample.java
> http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/SendMailExample.java
>
> The mail user agent can maintain a pool of persistent connections that can
> be reused for subsequent delivery requests.
>
> The NIO framework is basically a fork of Apache HttpCore with all HTTP
> dependencies removed.
>
> http://code.google.com/p/lightnio/
>
> You would have to get the latest snapshots of both libraries in order to run
> samples.
>
> I developed this code for my private use. If you do not think this is
> something that can be potentially useful for a larger user base, just ignore
> my message.
>
> Cheers
>
> Oleg
>
>
>
>
>> 2009/6/12 Oleg Kalnichevski <ol...@apache.org>:
>>>
>>> On Thu, Jun 11, 2009 at 04:30:58PM +0200, Markus Wiederkehr wrote:
>>>>
>>>> I've written a class SmtpTransport that can be used to send a Mime4j
>>>> message to an SMTP server.
>>>>
>>>> Currently it is very simple. Meaning it is not yet capable of
>>>> authentication or TLS or other extensions.
>>>>
>>>> Would it be worth to include this code in Mime4j?
>>>>
>>>> Cheers,
>>>> Markus
>>>>
>>>> PS: Testing is a bit of a PITA with sockets and all.. Robert, could
>>>> MPT help with that? I haven't looked into it yet..
>>>
>>> Markus et al
>>>
>>> _Coincidentally_, I have been working on a LMTP agent and LMTP client
>>> with
>>> support for mandatory extensions required by LMTP [1]: PIPELINING,
>>> ENHANCEDSTATUSCODES and 8BITMIME. The implementation is based a NIO
>>> framework
>>> derived from HttpCore NIO and should be quite scalable. This is my
>>> private
>>> project, but if there is interest in such work, I am willing to
>>> contribute it
>>> to James. Alternatively you are very welcome to contribute to the effort.
>>> It is
>>> ASLv2 licensed.
>>>
>>> Cheers
>>>
>>> Oleg
>>>
>>> [1] http://www.ietf.org/rfc/rfc2033.txt
>>>
>>>
>>>
>
>

Re: SMTP Transport?

Posted by Oleg Kalnichevski <ol...@apache.org>.
Norman Maurer wrote:
> Hi Oleg,
> 
> I would be very interested in this :-)
> 
> Bye,
> Norman
> 

Folks,

I finally have the library in a fairly usable (or shall I rather say 
testable) state. I can now send messages to the postfix daemon using my 
SMTP client transport and have the messages passed onto the local LMTP 
agent based on the same transport code for local delivery.

In essence I have a reasonably complete SMTP/LMTP transport library that 
implements RFC 2821 (minimum implementation), RFC 2033, plus a number of 
extensions required by LMTP: RFC 2034 (ENHANCEDSTATUSCODES), RFC 1854 
(PIPELINING), RFC 1652 (8BITMIME).

The code is still very experimental but good enough for getting the feel 
of the API.

Here's the sample of the LMTP transfer agent

http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/LocalMailServerTransportExample.java

Envelop validation / message delivery can be fully asynchronous. Long 
running processes such as DB or LDAP queries can be executed without 
blocking the I/O transport.

The client side transport can either be event (callback) driven

http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/LocalMailClientTransportExample.java

or future driven

http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/MailUserAgentExample.java
http://code.google.com/p/lightmtp/source/browse/trunk/src/examples/java/com/ok2c/lightmtp/examples/SendMailExample.java

The mail user agent can maintain a pool of persistent connections that 
can be reused for subsequent delivery requests.

The NIO framework is basically a fork of Apache HttpCore with all HTTP 
dependencies removed.

http://code.google.com/p/lightnio/

You would have to get the latest snapshots of both libraries in order to 
run samples.

I developed this code for my private use. If you do not think this is 
something that can be potentially useful for a larger user base, just 
ignore my message.

Cheers

Oleg




> 2009/6/12 Oleg Kalnichevski <ol...@apache.org>:
>> On Thu, Jun 11, 2009 at 04:30:58PM +0200, Markus Wiederkehr wrote:
>>> I've written a class SmtpTransport that can be used to send a Mime4j
>>> message to an SMTP server.
>>>
>>> Currently it is very simple. Meaning it is not yet capable of
>>> authentication or TLS or other extensions.
>>>
>>> Would it be worth to include this code in Mime4j?
>>>
>>> Cheers,
>>> Markus
>>>
>>> PS: Testing is a bit of a PITA with sockets and all.. Robert, could
>>> MPT help with that? I haven't looked into it yet..
>> Markus et al
>>
>> _Coincidentally_, I have been working on a LMTP agent and LMTP client with
>> support for mandatory extensions required by LMTP [1]: PIPELINING,
>> ENHANCEDSTATUSCODES and 8BITMIME. The implementation is based a NIO framework
>> derived from HttpCore NIO and should be quite scalable. This is my private
>> project, but if there is interest in such work, I am willing to contribute it
>> to James. Alternatively you are very welcome to contribute to the effort. It is
>> ASLv2 licensed.
>>
>> Cheers
>>
>> Oleg
>>
>> [1] http://www.ietf.org/rfc/rfc2033.txt
>>
>>
>>


Re: SMTP Transport?

Posted by Norman Maurer <no...@apache.org>.
Hi Oleg,

I would be very interested in this :-)

Bye,
Norman

2009/6/12 Oleg Kalnichevski <ol...@apache.org>:
> On Thu, Jun 11, 2009 at 04:30:58PM +0200, Markus Wiederkehr wrote:
>> I've written a class SmtpTransport that can be used to send a Mime4j
>> message to an SMTP server.
>>
>> Currently it is very simple. Meaning it is not yet capable of
>> authentication or TLS or other extensions.
>>
>> Would it be worth to include this code in Mime4j?
>>
>> Cheers,
>> Markus
>>
>> PS: Testing is a bit of a PITA with sockets and all.. Robert, could
>> MPT help with that? I haven't looked into it yet..
>
> Markus et al
>
> _Coincidentally_, I have been working on a LMTP agent and LMTP client with
> support for mandatory extensions required by LMTP [1]: PIPELINING,
> ENHANCEDSTATUSCODES and 8BITMIME. The implementation is based a NIO framework
> derived from HttpCore NIO and should be quite scalable. This is my private
> project, but if there is interest in such work, I am willing to contribute it
> to James. Alternatively you are very welcome to contribute to the effort. It is
> ASLv2 licensed.
>
> Cheers
>
> Oleg
>
> [1] http://www.ietf.org/rfc/rfc2033.txt
>
>
>

Re: SMTP Transport?

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, Jun 11, 2009 at 04:30:58PM +0200, Markus Wiederkehr wrote:
> I've written a class SmtpTransport that can be used to send a Mime4j
> message to an SMTP server.
> 
> Currently it is very simple. Meaning it is not yet capable of
> authentication or TLS or other extensions.
> 
> Would it be worth to include this code in Mime4j?
> 
> Cheers,
> Markus
> 
> PS: Testing is a bit of a PITA with sockets and all.. Robert, could
> MPT help with that? I haven't looked into it yet..

Markus et al

_Coincidentally_, I have been working on a LMTP agent and LMTP client with
support for mandatory extensions required by LMTP [1]: PIPELINING,
ENHANCEDSTATUSCODES and 8BITMIME. The implementation is based a NIO framework
derived from HttpCore NIO and should be quite scalable. This is my private
project, but if there is interest in such work, I am willing to contribute it
to James. Alternatively you are very welcome to contribute to the effort. It is
ASLv2 licensed.

Cheers

Oleg

[1] http://www.ietf.org/rfc/rfc2033.txt



Re: SMTP Transport?

Posted by Norman Maurer <no...@apache.org>.
Hi Markus,

what about trying to get in in commons net ?

Bye,
Norman

2009/6/11 Markus Wiederkehr <ma...@gmail.com>:
> On Thu, Jun 11, 2009 at 5:31 PM, Stefano Bagnara<ap...@bago.org> wrote:
>> I'm not sure how MIME4J and SMTP transport are related.
>> SMTP and MIME spec have not "interfaces" between them and for SMTP a
>> mime message is simply a stream.
>
> You are right but AFAIK there is no simple way to send a Mime4j
> message. You cannot use the Java Mail API because it expects a
> MimeMessage. Commons Net does not look very attractive.. I don't know
> of other alternatives.
>
>> An SMTP client should simply have a way to offer an outputstream to the
>> mime library or ask for an inputstream from the mime library: do I miss
>> any other integration point?
>
> No, except a higher level API could automatically extract sender and
> recipient addresses from the message, for example.
>
> Do you know of a solid low-level API that offers an output stream?
> That would be ideal.
>
> It should offer authentication and TLS, otherwise I have to write that
> stuff myself.
>
> Markus
>
>> Stefano
>>
>> Markus Wiederkehr ha scritto:
>>> I've written a class SmtpTransport that can be used to send a Mime4j
>>> message to an SMTP server.
>>>
>>> Currently it is very simple. Meaning it is not yet capable of
>>> authentication or TLS or other extensions.
>>>
>>> Would it be worth to include this code in Mime4j?
>>>
>>> Cheers,
>>> Markus
>>>
>>> PS: Testing is a bit of a PITA with sockets and all.. Robert, could
>>> MPT help with that? I haven't looked into it yet..
>

Re: SMTP Transport?

Posted by Markus Wiederkehr <ma...@gmail.com>.
On Thu, Jun 11, 2009 at 5:31 PM, Stefano Bagnara<ap...@bago.org> wrote:
> I'm not sure how MIME4J and SMTP transport are related.
> SMTP and MIME spec have not "interfaces" between them and for SMTP a
> mime message is simply a stream.

You are right but AFAIK there is no simple way to send a Mime4j
message. You cannot use the Java Mail API because it expects a
MimeMessage. Commons Net does not look very attractive.. I don't know
of other alternatives.

> An SMTP client should simply have a way to offer an outputstream to the
> mime library or ask for an inputstream from the mime library: do I miss
> any other integration point?

No, except a higher level API could automatically extract sender and
recipient addresses from the message, for example.

Do you know of a solid low-level API that offers an output stream?
That would be ideal.

It should offer authentication and TLS, otherwise I have to write that
stuff myself.

Markus

> Stefano
>
> Markus Wiederkehr ha scritto:
>> I've written a class SmtpTransport that can be used to send a Mime4j
>> message to an SMTP server.
>>
>> Currently it is very simple. Meaning it is not yet capable of
>> authentication or TLS or other extensions.
>>
>> Would it be worth to include this code in Mime4j?
>>
>> Cheers,
>> Markus
>>
>> PS: Testing is a bit of a PITA with sockets and all.. Robert, could
>> MPT help with that? I haven't looked into it yet..

Re: SMTP Transport?

Posted by Stefano Bagnara <ap...@bago.org>.
I'm not sure how MIME4J and SMTP transport are related.
SMTP and MIME spec have not "interfaces" between them and for SMTP a
mime message is simply a stream.

An SMTP client should simply have a way to offer an outputstream to the
mime library or ask for an inputstream from the mime library: do I miss
any other integration point?

Stefano

Markus Wiederkehr ha scritto:
> I've written a class SmtpTransport that can be used to send a Mime4j
> message to an SMTP server.
> 
> Currently it is very simple. Meaning it is not yet capable of
> authentication or TLS or other extensions.
> 
> Would it be worth to include this code in Mime4j?
> 
> Cheers,
> Markus
> 
> PS: Testing is a bit of a PITA with sockets and all.. Robert, could
> MPT help with that? I haven't looked into it yet..
> 


Re: SMTP Transport?

Posted by Markus Wiederkehr <ma...@gmail.com>.
On Thu, Jun 11, 2009 at 5:15 PM, Robert Burrell
Donkin<ro...@gmail.com> wrote:
> On Thu, Jun 11, 2009 at 3:30 PM, Markus
> Wiederkehr<ma...@gmail.com> wrote:
>> I've written a class SmtpTransport that can be used to send a Mime4j
>> message to an SMTP server.
>>
>> Currently it is very simple. Meaning it is not yet capable of
>> authentication or TLS or other extensions.
>>
>> Would it be worth to include this code in Mime4j?
>
> so long as it's in a separate module, i'd say yes for now
>
> commons net (http://commons.apache.org/net/) already supports SMTP.
> it's probably worthwhile having a bit of a think where the new mime4j
> code would fit into the ecosystem...

I ran svn2cl in NET's o.a.commons.net.smtp package and there was no
real development in the last 6 years except for a fix for NET-178 (and
I did not look farther back).

There does not seem to be ESMTP support, not even for EHLO.

SMTPClient.sendMessageData() returns a Writer instead of an OutputStream.

Does not look very promising to me..

> <snip>
>
>> PS: Testing is a bit of a PITA with sockets and all.. Robert, could
>> MPT help with that? I haven't looked into it yet..
>
> yes but a little work would be required
>
> BTW the first MPT release needs one more vote if you have a few spare
> cycles to review it

What would you want me to do? Compile and review the source? Is there
some kind of checklist I should follow?

Markus

Re: SMTP Transport?

Posted by Robert Burrell Donkin <ro...@gmail.com>.
On Thu, Jun 11, 2009 at 3:30 PM, Markus
Wiederkehr<ma...@gmail.com> wrote:
> I've written a class SmtpTransport that can be used to send a Mime4j
> message to an SMTP server.
>
> Currently it is very simple. Meaning it is not yet capable of
> authentication or TLS or other extensions.
>
> Would it be worth to include this code in Mime4j?

so long as it's in a separate module, i'd say yes for now

commons net (http://commons.apache.org/net/) already supports SMTP.
it's probably worthwhile having a bit of a think where the new mime4j
code would fit into the ecosystem...

<snip>

> PS: Testing is a bit of a PITA with sockets and all.. Robert, could
> MPT help with that? I haven't looked into it yet..

yes but a little work would be required

BTW the first MPT release needs one more vote if you have a few spare
cycles to review it

- robert