cancel
Showing results for 
Search instead for 
Did you mean: 

Problems sending mail in differents instances

Former Member
0 Kudos

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



It is so strange, because, is the same Portal App, the same Exchange server, and the same users (from, to), the only difference are the instances:

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.-

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (1)

Answers (1)

Benny
Product and Topic Expert
Product and Topic Expert
0 Kudos

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