Skip to Content
author's profile photo Former Member
Former Member

Problems sending mail in differents instances

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 08:45 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 21, 2007 at 08:22 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.