Showing results for 
Search instead for 
Did you mean: 

Unable to check UserGroup&send email

Former Member
0 Kudos

Dear all

I developed feedback form, through which i'm able to send email to the respective "emailid" which i was mentioned in the form, based on logedon email id from portal. But in our secnario we divited the customers to different groups...lets say Branch1, branch2 etc..

I will assign the user to the Branch1. so it has to automatically find which group he belongs to and send email to the appropriate id of that branch.

public void doProcessAfterInput() throws PageException {

InputField myInputField = (InputField) getComponentByName("EMAIL_ADDR");

HtmlEdit txtdescr = (HtmlEdit)getComponentByName("Edit_Text");

if (myInputField != null) {

IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();

IUserContext iuc = request.getUser();

IGroupFactory gf=UMFactory.getGroupFactory();

this.email_from = iuc.getEmail();

}if (txtdescr != null) {

this.txtdescr = txtdescr.getText();}


public void doProcessBeforeOutput() throws PageException {


IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();

IUserContext iuc = request.getUser();

try {

InternetAddress fromAddress = new InternetAddress(iuc.getEmail());

} catch (AddressException e) {

// TODO Auto-generated catch block


public void send_mail (){


Properties props = new Properties();

//put the smtp server here


Session session = Session.getDefaultInstance(props,null);

Message msg = new MimeMessage(session);

IUser loggeduser = request.getUser();

if (loggeduser.isMemberOfGroup("BLR", true)){

InternetAddress addressTo = new InternetAddress("");{

else if(){....}



msg.setSubject("Portal Feedback");

msg.setContent(txtdescr, "text/html");

msg.setSentDate(new GregorianCalendar().getTime());


} catch (Exception E){ .....}}}}



Message was edited by: Pradeep Reddy

Accepted Solutions (1)

Accepted Solutions (1)

Active Contributor
0 Kudos

Hi Pradeep,

1.) Use the "Code" button of the SDN forum editor to mark code. Makes it much more readable.

2.) Reduce any code submitted to a minimum showcase so that the problem is reproducable. More is not needed any many people will be shocked reading more than ten lines of code...

3.) "its not working" is not very precise!? How did it work, what is the concrete problem? Did the isMemberOfGroup never return true? Are you sure to have passed the correct uniqueGroupID?

4.) An alternative approach would be - anyhow, if you have a problem with one approach, probably you also would have it with the other.

Hope it helps


Former Member
0 Kudos

Hi Detlev

Yeah..i Passed correct uniqueGroupId. It is sending mail...but unable to find to which mail id it is sending... it is not sending specific mail id which i have mentioned in code.



Active Contributor
0 Kudos

Hi Pradeep,

> It is sending mail...

> but unable to find to which mail id it is sending...

Eeeem - if you don't know to which mail id it is sending the mail, how do you know that it in fact <i>sends</i> the mail?! Are you sure that no exception is thrown?!

For alternaive mailing approache(s) see /thread/98781 [original link is broken]

Hope it helps


Answers (0)