cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get the email address of the administrator in Windchill ?

SOLVED
Highlighted
Regular Member

How can I get the email address of the administrator in Windchill ?

I have a java method that will send an email when dxf creation failes but how I can get the email address of the administrator configurated at Windchill ?

I hardcoded the email address now but it should be better if the java class does not need adaption when the administrator should ever change.

Best regards,

Bernard

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: How can I get the email address of the administrator in Windchill ?

Bernard, Once you have the admin as a WTPrincipal object, you can use below lines to fetch emailAddress dynamically:

String adminEmailId = null;

if(WTUser.class.isAssignableFrom(admin.getClass())){

WTUser adminUser = (WTUser)admin;

adminEmailId = adminUser.getEMail();

}

-Prabhash

View solution in original post

8 REPLIES 8

Re: How can I get the email address of the administrator in Windchill ?

Not sure if it helps any, but the administrator's email address is listed in the wt.properties file. Maybe you can either retrieve the property with Java or manually parse the file. (It's available anonymously from <windchill url>/Windchill/wt.properties)

Look for these properties:

wt.mail.from=

wt.org.principalAdministratorEmail=

wt.notify.notificationSenderEmail=

Re: How can I get the email address of the administrator in Windchill ?

Another question would be which administrator(s) you want to contact.

For instance, in 10.2 (and maybe 10.1, I forget), the JMX-Administrators list is initially populated with the e-mail address entered at install time and this list can adjusted from that point to include more e-mail addresses.

Re: How can I get the email address of the administrator in Windchill ?

I like to mail the Site administrator like in next picture. We are still running 9.1Snap1.jpg

Re: How can I get the email address of the administrator in Windchill ?

The wt.mail.from is the senders email address (WindchillAlerts@lvd.be), I was looking for the administrator that is configurated via Site/Administrators, see picture a litle further.

Re: How can I get the email address of the administrator in Windchill ?

Hello Bernard,

I guess you can use SessionHelper.manager.getAdministrator() to fetch the wcadmin user.

Let me know if you need any clarification.

-Prabhash

Re: How can I get the email address of the administrator in Windchill ?

Yes, Prabhash, this is what I have so far....

public void SendMailToAdmin(String errorMessage, Exception e)

{

try

{

EMailMessage email = EMailMessage.newEMailMessage();

wt.session.StandardSessionManager manager = wt.session.StandardSessionManager.newStandardSessionManager();

WTPrincipal admin = manager.getAdministrator();

String[] emailAddress = {"bwlf@lvd.be"};

email.addEmailAddress(emailAddress);

email.setSubject(errorMessage);

email.setOriginator(admin);

email.addPart(e.toString(), "text/html");

email.send(true);

}

catch (Exception Exception)

{

log.info("Creation of error email failed.\n" + Exception.toString());

}

}

Re: How can I get the email address of the administrator in Windchill ?

Bernard, Once you have the admin as a WTPrincipal object, you can use below lines to fetch emailAddress dynamically:

String adminEmailId = null;

if(WTUser.class.isAssignableFrom(admin.getClass())){

WTUser adminUser = (WTUser)admin;

adminEmailId = adminUser.getEMail();

}

-Prabhash

View solution in original post

Re: How can I get the email address of the administrator in Windchill ?

Thank you Prabhash, it works.