cancel
Showing results for 
Search instead for 
Did you mean: 

Urgent ::: Sending java mail from AbstractPortalComponent

Former Member
0 Kudos

Hi all,

I am using WAS SP9 (with EP & KM). I am connecting to corporate exchange server and i am sending mails and i have permission to relay from my server also. The code i used is working fine in webdynpro and also in simple java file but its not working in Abstract Portal Component. Following is the code snippet....


boolean sessionDebug = false; 
Properties props = System.getProperties(); 
props.put("mail.smtp.auth","true");
props.put("mail.transport.protocol", "smtp"); 
Session session = Session.getDefaultInstance(props, null);//getting error in this line 
session.setDebug(sessionDebug); 
.....

In the above acode I am getting PRT error when i get instance of session by session.getDefaultInstance method.

I didnt configure anything in the server(like javamail client). Help me out on this...

Thanks in Advance..

Regards

Vasu

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member394902
Contributor
0 Kudos

1.do not use

Properties props = System.getProperties();

instead use

Properties props = new Properties();

props.put("mail.smtp.auth","true");

props.put("mail.transport.protocol", "smtp");

2. Why are you setting mail.smtp.auth to true. Most of the SMTP servers do not need authentication when sending mails provided the e-mail address of the sender is a valid address.

Akhilesh

Dont forget to awars points if useful.

Former Member
0 Kudos

Hi Akhilesh,

Thanks for the info. I tried what u told. But,i still have a problem.

String host = "<host ip address>";

boolean sessionDebug = false;

Properties props = new Properties();

props.put("mail.smtp.host", host);

props.put("mail.smtp.auth","true");

props.put("mail.transport.protocol", "smtp");

Session session = Session.getDefaultInstance(props, null); //i am getting the error in this line

session.setDebug(sessionDebug);

Any ideas please?

<b>Regards,

Sai Krishna.</b>

Former Member
0 Kudos

Hi All,

Any ideas or solutions please?

I am also trying to trigger email from PDK.

I am also able to trigger emails from webdynpro, but the same code is not working in AbstractPortalComponent.

I would be very grateful if you guys give some ideas.

<b>Regards,

Sai Krishna.</b>

Former Member
0 Kudos

Hi Vasu,

Did you try to use the mail session from the j2ee engine. Add the smtp server name in the JAVAMAIL service in Visual Admin and try with that. There is an example in the J2EE examples page link which is there in the index.html of the j2ee engine.

I think you are getting the error because you are not using the portal mail session.

Regards

Prakash

Former Member
0 Kudos

Any Solutions???

Regards

Vasu