1 Reply Latest reply on Feb 10, 2003 11:30 AM by ABAZIOU

    Problem Sending a Mail from a sessionbean

    Stefan Kuehn Newbie

      Hi!

      This is really not a JBoss-Problem, but I would appreciate your Help.

      I'm not succeding in sendin a Mail from a sessionbean.

      The problem is, that the MailServer requires an autentification.
      It's an pop3 Mailserver.

      Im Using JBoss 3.0.2
      J2SE 1.4.0_01
      J2EE 1.4 (beta) (which contains an pop3 protcol)

      I have added the file javamail.providers to my META-INF directory
      (in my applications jar-file).
      Content of this file:
      protocol=pop3; type=store; class=com.sun.mail.pop3.POP3Store; vendor=Sun Microsy stems, Inc;

      I have tried this code:
      Transport tmpTransport = session.getTransport("pop3");
      if (!tmpTransport.isConnected())
      tmpTransport.connect(m_POP3Host, m_POP3Account, m_POP3Password);

      tmpTransport.send(msg);

      (Im successfully using the same values for m_POP3Host, m_POP3Account, m_POP3Password im outlook express!)

      This attempt results in an exception saying "invalid provider".

      If i ommit the "pop3" in the statement:
      Transport tmpTransport = session.getTransport("pop3");

      ...i get the message:
      Sending failed;
      nested exception is: class javax.mail.SendFailedException:
      Invalid Addresses;
      nested exception is: class javax.mail.SendFailedException: 554 :
      Relay access denied

      I suppose the pop3-autentification is not done right.

      Can anyone help?
      I realle would appreciate some sample code.
      Thanks!

      Stefan Kühn
      (stefan.kuehn@gmx.net)

        • 1. Re: Problem Sending a Mail from a sessionbean
          ABAZIOU Newbie

          I think the problem is that you want to send an email, seeing your code :
          tmpTransport.send(msg);
          and msg contains them mail you want to send.

          But pop3 is a protocol to read mail you receipt.
          If you really want to receive mail, you should code
          something like tmpTransport.receive(...);
          i'd never write a pop3 reader


          The good protocol to send a mail should be 'smtp',
          so you should code :
          Transport tmpTransport = session.getTransport("smtp");

          That the reason why you have the message 'Invalid provider'

          Hope this help you