File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes Java Mail API !!!!!!!!!!!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Java Mail API !!!!!!!!!!!!!" Watch "Java Mail API !!!!!!!!!!!!!" New topic

Java Mail API !!!!!!!!!!!!!

Anoop Krishnan
Ranch Hand

Joined: May 03, 2001
Posts: 163
I need an application which has to send 400000 mails in 2 hours
is Java Mail API can handle this requirement or is there any other API available

I just want to know is there any body call my bean's Getter and Setter methods with "Please" in front - My favorite quip from Bugzilla
Detlev Beutner
Ranch Hand

Joined: Jul 13, 2001
Posts: 76
I just tested the performance with a very simple program:

It takes... about 50(!) seconds to send this 50 mails! This for sure also depends on the mail-server (in this case it is an MSEX) and some other circumstances, but it indicates that it should be a really hard task to achieve your goal...
As you realize, I did not try anything to speed up the sending; for performance questions (and some other) have a look at (interview about JavaMail 1.2)
On the other hand, it is less a question of "another" mail-api but a question of the possible use of an other SMTP-provider (I used the SUN-implementation; but on there is no other).
But: Have a look at and try out, maybe this helps (even if I do not like do leave the sun-path...)
Hope it helps
[This message has been edited by Detlev Beutner (edited July 20, 2001).]
Chuck Lorenz

Joined: Jul 06, 2001
Posts: 6
Will you get better results if you replace with ? I don't know from personal experience (too new to the API), but the short course from JGuru on the Fundamentals of the JavaMail API seems to imply it.
The final part of sending a message is to use the Transport class. This class speaks the protocol-specific language for sending the message (usually SMTP). It's an abstract class and works something like Session. You can use the default version of the class by just calling the static send() method:
Or, you can get a specific instance from the session for your protocol, pass along the username and password (blank if unnecessary), send the message, and close the connection:
message.saveChanges(); // implicit with send()
Transport transport = session.getTransport("smtp");
transport.connect(host, username, password);
transport.sendMessage(message, message.getAllRecipients());
This latter way is best when you need to send multiple messages, as it will keep the connection with the mail server active between messages. The basic send() mechanism makes a separate connection to the server for each method call.

I agree. Here's the link:
subject: Java Mail API !!!!!!!!!!!!!
It's not a secret anymore!