• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting Up A Delay Between E-mail tranmissions  RSS feed

 
Rick Fischer
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am doing a bulk email of about 100 e-mails. After 80 or so successful tranmissions an exception is thrown: Could not connect to SMTP host. The exception is thrown on about 5 transmissions, then it will successfully complete the remaining e-mail tranmissions. My web hosting provider suggested setting up a delay between transmissions, as the message queue is being filled up and needs time to complete each tranmission. How can I set up this delay between email?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By calling Thread.sleep()?
 
Rick Fischer
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ernest, That worked
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you explain what you mean by "tranmissions"? Is this when you call the connect method on a Transport object or when you call the send method?

I ask because it could be that you are using the static convenience method Transport.send(), which opens and closes a new connection for every message you send. You might consider reusing the connection. That is so long as your are not spoofing the from address (or changing it once you have spoofed it once) you should be able to reuse one connection for all messages. And though your server admin probably knows better then I do - it would take a fairly miserly server config to not be able to process 100 messages.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!