How to send mail faster?
843830May 4 2005 — edited Sep 29 2005I am using JDK1.4 with the latest JavaMail API. I am sending out emails (to different subscribers but with the same email content). However, on my 2.7ghz machine it seems to only send out around 7 emails a second. Anyway i can send it out faster? I send the emails to Communigate. This is the method that is recalled to send each email, 12,000 need to be sent out:
private void sendMail(AlertSubscriber pSubscriber) {
AlertSubscriber subscriber = pSubscriber;
MimeMessage msg = null;
Address toAddr = null;
if (subscriber != null && fromAddr != null) {
try {
System.out.println("sending email to " + subscriber.getEmailAddress());
msg = new MimeMessage(session);
msg.setContent(subscriber.getEmailBody(), "text/html");
msg.setSubject(subscriber.getEmailSubj());
toAddr = new InternetAddress(subscriber.getEmailAddress());
msg.setFrom(fromAddr);
msg.addRecipient(Message.RecipientType.TO, toAddr);
msg.saveChanges(); // implicit with send()
transport.sendMessage(msg, msg.getAllRecipients());
}
catch (Exception e) {
System.out.println(
"Channel - sendMail() error building and sending out email to " +
subscriber.getEmailAddress() + " .id is " + subscriber.getId() +
" . Error: " + e);
}
}