Hi,

I have two thoughts along the line

+) using the Commons Email API you get access to the underlying MimeMessage which is pretty much the "clean bean email" you are looking for +) the fact that a Email can send itself is "inversion of control" but the bad one - using some sort of transport layer based on interfaces would be nice

Cheers,

Siegfried Goeschl

zheng hao wrote:
hi all Commons Email dev,

I found when i want to send several emails in one connection, Commons Email
doesn't help. It connects to the SMTP server per email, and it spends more
time on authentication than sending the mails themselve (most SMTP server
needs authentication). So I have to code on the javamail api directly,
something like:

        SMTPSSLTransport strans = (SMTPSSLTransport) sess.getTransport();
        strans.connect();
        int num = 1000;
        for (int i = 0; i < num; i++) {
            SMTPMessage email = createMessage(sess, num);
            strans.sendMessage(email, email.getAllRecipients());
        }
        strans.close();

In my straightforward test, it saves me 2/3 of the time. So I think it would
be nice to add this kind of function into Commons Email, to make it more
useful. My suggestion is to extract a clean bean Email, which contains all
email dependent information, e.g. TO, CC, Subject, etc, but leaves out all
host/server dependent information, e.g. authenticator, host address, host
port, etc. After that, we can still provide simple convenience method for
those who only want to send one mail every time. And it is possible to add
methods like 'addEmail' to add several mails before sending, and later on,
when it is called 'send', we can send them in one SMTP connection. Does it
useful? Thank you all.

Hao Zheng


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to