on 11-20-2007 10:33 PM
Hi everyone!
I have a strange problem when my Portal application (JSPDynpage) try to send mail using the exchange server - note: this server works fine when I send a mail by collaboration-
In DEV instance, the same application works fine and the mails are sending without problems, but... in QA this exceptions occurs:
Sending failed; nested exception is: javax.mail.AuthenticationFailedException
DEV
/QA
Any Idea??
any suggest??
this is the code:
try{
Properties props = System.getProperties();
props.put("mail.smtp.host", "x.x.x.x");
props.put("mail.smtp.auth", "true");
Session session = Session.getDefaultInstance(props, null);
com.sap.security.api.IUser User = UMFactory.getUserFactory().getUserByLogonID(iuser.getId());
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(User.getEmail()));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(toAdmin));
message.setSubject("Inscripción a Curso ");
message.setText("blablabla");
Transport.send( message );
}
catch(Exception ex){
error = "Error enviando mail : "+ex.getMessage();
}
thanks in advance.
it is very urgent, I promise points
Leslie.-
Hi Leslie,
Transport.send( message );
can only use with no authentification. Otherwise you need this code :
if(auth)
{
Transport transport = session.getTransport("smtp");
transport.connect(smtpHost,smtpLogin,smtpPassword);
message.saveChanges();
transport.sendMessage(message, message.getAllRecipients());
transport.close();
}
else
Transport.send(message);
Best regards,
Mathieu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Leslie,
check the roles your user has in both environments. I could imagine that your user has different rights on the different systems.
Regards,
Benny
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.