File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Problem with java mail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Problem with java mail" Watch "Problem with java mail" New topic

Problem with java mail

Makarand Parab
Ranch Hand

Joined: Dec 10, 2004
Posts: 121
Hi All
My application is a java batch application, which executes certain batch of work and sends a status mail once the batch of work is done. I am using java mail to send the email. My mail client is Lotus Notes. If i give the group name in the "To" block, the mail class does not throw any exception and runs fine but i do not recieve the status mail. If i give my mail id in the "To" block, it sends me a status mail.

In short, i am not able to send emails to a particular group through java mail. can anybody let me know what's the problem.

Thanks in advance

Makarand Parab
Rovas Kram
Ranch Hand

Joined: Aug 08, 2003
Posts: 135
I making an educated guess here because I've used the JavaMail API and I don't think there's a concept of groups. When you send mail to a group using Lotus Notes, the group is converted to individual addresses by the Lotus Notes client before sending to the outgoing mail server. When you use JavaMail, there's no code to translate the group into individual addresses.
Makarand Parab
Ranch Hand

Joined: Dec 10, 2004
Posts: 121
Thanks for the reply, but i have a query. Is there any way to send mail to multiple user. If i try to put comma seperated mail id's it gives error saying [Invalid string]. Is there any way out or shd comma seperated mail id's should work.
Id there is any good example live on net to send mails to multiple users using java mail, plz do let me know. I would highly appreciate it.

Thz in advance

Makarand Parab.
Chit Ming Chong
Ranch Hand

Joined: Sep 09, 2004
Posts: 49
I also want to know besides looping through all the recipients' addresses one by one what else can we do.
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

In short, i am not able to send emails to a particular group through java mail.

A "group" in Notes (if I remember right) is not an address as such, rather a type of document, yes? So a group does not represent a recognizable address as far as SMTP is concerned - there is some conversion going on on the server (as Rovas Kram points out).

You can't use a CVS list of addresses, because Java Mail's InternetAddress class will parse the CSV to make sure it is RFC822 complient. But look at the Transport class's send methods - you'll notice that two take an array of InternetAddresss. Presuming you know the addresses in the Lotus Group, you can send to all of them this way.

I have a vague memory that there is an IBM supplied transport implementation for Lotus which ships with Domino. You might like to search IBM's site for such a thing - if there is it might let you use groups directly.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
subject: Problem with java mail
jQuery in Action, 3rd edition