• Post Reply Bookmark Topic Watch Topic
  • New Topic

Issue in sending email to a group email using java mail.  RSS feed

 
Akshat Tambe
Greenhorn
Posts: 7
Java Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

As subject is self explanatory - I am facing issue in sending email to a group email using java mail.

I have gone through through several blogs & articles which are of no help & does not have a precise answer or hangs in middle.

Can you please help. Here is my mail class for you. My mail is going to have a link to ftp location & a text file as an attachment.

To separate the issue i tried to send a simple mail to the group as well but that didn't help either.

I tried to find answers in places like java-forums.org & Stack overflow but found no luck.

I appreciate your quality time & help in providing an insight to the issue.

Thanks in advance.
Akshat

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Though your subject says that you face an issue with your program, it would be good for us to know what exactly is the issue that you face to help you better.

Welcome to Javaranch!
 
Akshat Tambe
Greenhorn
Posts: 7
Java Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Joe

To explain the issue better-

My Automation framework when completes the execution of test cases, it sends a mail to me with the link to execution report & a log file as an attachment. Now the audience for the report has expanded & we need to send the mail to a group email address.

When I set the email (to say group.email@company.com) none of the users in the group receives the mail. Where as if I send the email to my email address or anyone else email address it works.

I get no logs or error for this & so I am not able to understand the issue correctly.

An insight from the experts will help in understanding the issue.

Thanks
Akshat
 
Akshat Tambe
Greenhorn
Posts: 7
Java Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I got to know that "Java doesn't know whether an email address is for a single user or a group. Probably the issue with SMTP Server". HOW!!

To elaborate this a bit more for you, when the test-team get the bits to test from dev-team, an email get floated automatically from Electric Commander to a group email address about the build generation. I guess with this in reference you may be able to explain more. I believe there must be a way to address this issue. Your expert advice will be more than a help.

Also, do i have to expand the group email to all the individuals on the list because there is no way i can send mail to a group e-mail address ?
I was wondering how come other email application like Gmail or Outlook itself will be handling it !! It should be as simple as sending a mail. do you know the root cause behind the issue. Though I will try to expand the group email to all the individuals on the list.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How could your Java code possibly know whether an email address is for an individual or if it's a group? That's an issue the mail server handles.

What have you done to debug this? Do you have access to the mail server logs? Those would tell you what happens when you try to send the mail.
 
Campbell Ritchie
Marshal
Posts: 56578
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Too difficult for “beginning”: moving thread.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Akshat Tambe wrote:I am facing issue in sending email to a group email using java mail...

Ashkat,

Please DontWriteLongLines. It makes your post very difficult to read.
I've broken yours up this time, but please read the link.

Thanks

Winston
 
Akshat Tambe
Greenhorn
Posts: 7
Java Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Winston,

Will take case of it.
 
Akshat Tambe
Greenhorn
Posts: 7
Java Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf,

Have no access to mail server logs & so couldn't get hold of any of the errors/info to debug.

All I tried is to send mail to individual & later to a group.
I am wondering that why there isn't any details of sending mail to a group using java main & no tutorials as well.

If I find a workaround will update this post.

But would like to conclude this post with a correct solution


Thanks
Akshat
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said, there is no concept of "sending to a group address" as far as Java is concerned. Java has no knowledge of that, nor does it need to; it's up to the mail server to distribute a mail to all group members in that case.

One thing you can do is to turn on the JavaMail debug flag which will cause all kinds of information to be output. If that looks like everything is OK on the client side, you will have to work with the mail server admin to debug this further.
 
Akshat Tambe
Greenhorn
Posts: 7
Java Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agree Ulf. I got you point.

I better keep it simple & add recipients to MimeMessage obj like below-



or rather keep all the recipients in an array & pass them to
method.


Thanks Ulf & Everyone. Its a good experience to be on CodeRanch.
Akshat
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you suddenly not want the mail server to handle the list? That's what lists are there for, after all. By hardcoding the addresses you lose the benefit of that.
 
Akshat Tambe
Greenhorn
Posts: 7
Java Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep,

Want to move forward for now as it is the part of a POC. But I do consider your suggestion. It will be sensible to create a list & let mail server handle it.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!