dcsimg
problems whith authentification (mail.smpt.aut). SMTP server under NT, "javamail" client running under unix.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   pierre_Laurens
Posted On:   Wednesday, March 20, 2002 08:35 AM

I try to send mail (using javamail), whith authentification. I use an exchange server (windows NT, SMTP protocol). When I execute my project under NT, there is no problem : Here is a part of the SMTP debug : DEBUG SMTP SENT: EHLO myuser DEBUG SMTP RCVD: 250-myhost Hello [myuser] 250-XEXCH50 250-HELP 250-ETRN 250-DSN 250-SIZE 6164480 250-AUTH LOGIN 250 AUTH=LOGIN DEBUG SMTP Found extension "XEXCH50", arg "" DEBUG SMTP Found extension "HELP", arg "" DEBUG SMTP Found extension "ETRN", arg "" DEBUG   More>>

I try to send mail (using javamail), whith authentification.

I use an exchange server (windows NT, SMTP protocol).

When I execute my project under NT, there is no problem :

Here is a part of the SMTP debug :

DEBUG SMTP SENT: EHLO myuser

DEBUG SMTP RCVD: 250-myhost Hello
[myuser]

250-XEXCH50

250-HELP

250-ETRN

250-DSN

250-SIZE 6164480

250-AUTH LOGIN

250 AUTH=LOGIN

DEBUG SMTP Found extension "XEXCH50", arg ""

DEBUG SMTP Found extension "HELP", arg ""

DEBUG SMTP Found extension "ETRN", arg ""

DEBUG SMTP Found extension "DSN", arg ""

DEBUG SMTP Found extension "SIZE", arg "6164480"

DEBUG SMTP Found extension "AUTH", arg "LOGIN"

DEBUG SMTP Found extension "AUTH=LOGIN", arg ""

DEBUG SMTP: Attempt to authenticate

DEBUG SMTP SENT: AUTH LOGIN

DEBUG SMTP RCVD: 334 key

DEBUG SMTP SENT: myusr (encoded base64)

DEBUG SMTP RCVD: 334 ....

DEBUG SMTP SENT: mypassword (encoded base64)

DEBUG SMTP RCVD: 235 LOGIN authentication successful

....


But when I run my project under unix, it doesn't work fine.

It doesn't even try to "attempt to authenticate", so the exception "javax.mail.SendFailedException: 550 Relaying is prohibited" is thrown (that's normal).


Is there known differences between javamail under unix and javamail under NT ?


Can you help me , please ?

   <<Less

Re: problems whith authentification (mail.smpt.aut). SMTP server under NT, "javamail" client running under unix.

Posted By:   pierre_Laurens  
Posted On:   Friday, March 22, 2002 01:40 AM

More precisions :

Here is a part of the code i am using


Properties props = System.getProperties();

System.out.println("host : "+m_host);

props.put("mail.smtp.host", "srvaex.qualiac.fr");

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

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

NCSAuthenticator myau = new NCSAuthenticator(m_user, m_password);

Session session = Session.getInstance(props, myau);

session.setDebug(m_debug);

Transport trans = null;

MimeMessage msg = new MimeMessage(session);

InternetAddress[] address = null;

InternetAddress[] copie = null;

try

{

System.out.println("m_to :"+m_to);

address = InternetAddress.parse(m_to, false);

if (m_to.length() == 0)

{

return;

}

if (m_copie.length()>0)

{

copie = InternetAddress.parse(m_copie, false);

}

}

catch (AddressException aex)

{

}

try

{

trans = session.getTransport(address[0]);

//trans.addTransportListener(new TransportHandler());



MimeBodyPart mbp1 = new MimeBodyPart();

MimeMultipart mp = new MimeMultipart();

msg.setFrom(new InternetAddress(m_from));

msg.setRecipients(Message.RecipientType.TO, address);

if (m_copie.length()>0) msg.setRecipients(Message.RecipientType.CC, copie);

msg.setContentID("Qualiac WIM - Requette");

if (m_subject != null) msg.setSubject(m_subject,m_charset);

mbp1.setText("test unix", m_charset);

mp.addBodyPart(mbp1);



msg.setContent(mp);

msg.setSentDate(new java.util.Date());

try {trans.send(msg);}

finally

{

try

{

// Fermeture du transport

trans.close();

}

....


That's work perfectly on windows NT.

But, under UNIX :
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]

DEBUG: SMTPTransport trying to connect to host myhost, port 25

DEBUG SMTP RCVD: 220 myhost ESMTP Server (Microsoft Exchange Internet Mail Service 5.5.2650.21) ready

DEBUG SMTP SENT: helo

DEBUG SMTP RCVD: 250 OK

DEBUG: SMTPTransport connected to host myhost, port: 25

DEBUG SMTP SENT: mail from:

DEBUG SMTP RCVD: 250 OK - mail from

DEBUG SMTP SENT: rcpt to:

DEBUG SMTP RCVD: 550 Relaying is prohibited

Invalid Addresses

my external adress

DEBUG SMTPTransport: Sending failed because of invalid destination addresses

DEBUG SMTP SENT: rset

DEBUG SMTP RCVD: 250 OK - Reset


That doesn't use neither ehlo,useEhlo true, useAuth true, AUTH LOGIN .... even if i have precised to use this options !

Help !!!
About | Sitemap | Contact