Trouble to authentications vs SMTP server
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Val_Maslau
Posted On:   Tuesday, March 19, 2002 06:57 AM

What I do wrong? Here is the code that I use: Properties props = System.getProperties(); props.put("mail.transport.protocol","smtp"); props.put("mail.transport.user","f_user"); props.put("mail.host","smtp.mail.org"); ........ javax.mail.Session session = Session.getInstance(props,null); session.setDebug(true); ......... msg.setContent(mp); Transport.send(msg); And Here the answers of the SMTP server: [204] DEBUG SMTP SENT: QUIT [203] [202] DEBUG SMTP RCVD: 505 5.7.3 Client    More>>

What I do wrong? Here is the code that I use:

Properties props = System.getProperties();

props.put("mail.transport.protocol","smtp");

props.put("mail.transport.user","f_user");

props.put("mail.host","smtp.mail.org");

........

javax.mail.Session session =

Session.getInstance(props,null);

session.setDebug(true);

.........

msg.setContent(mp);

Transport.send(msg);

And Here the answers of the SMTP server:

[204] DEBUG SMTP SENT: QUIT

[203]

[202] DEBUG SMTP RCVD: 505 5.7.3 Client was not authenticated

[201] DEBUG SMTP SENT: MAIL FROM:

[200]

[199] 250 OK

[198] 250-VRFY

[197] 250-CHUNKING

[196] 250-BINARYMIME

[195] 250-8bitmime

[194] 250-ENHANCEDSTATUSCODES

[193] 250-DSN

[192] 250-PIPELINING

[191] 250-ETRN

[190] 250-SIZE 2097152

[189] 250-ATRN

[188] 250-TURN

[187] 250-AUTH=LOGIN

[186] 250-AUTH GSSAPI NTLM LOGIN

[185] DEBUG SMTP RCVD: 250-smtp.mail.org Hello [xxx.xx.xxx.xxx]

[184] DEBUG SMTP SENT: EHLO postweb1

[183]

[182] DEBUG: SMTPTransport connected to host "smtp.mail.org", port: 25

[181]

[180] DEBUG SMTP RCVD: 220 smtp.mail.org Microsoft ESMTP MAIL Service, Version: 5.0.2195.2966 ready at Tue, 19 Mar 2002 16:13:29 +0200

[179]

[178] DEBUG: SMTPTransport trying to connect to host "smtp.mail.org", port 25

[177]

[176] DEBUG SMTP: useEhlo true, useAuth false

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

   <<Less

Re: Trouble to authentications vs SMTP server

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

Hello.
try this :

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


Then replace your

Session.getInstance(props,null);

by

Auth myauth = new Auth(m_user, m_password);

session = Session.getInstance(props, myauth);


where Auth class is something like :

class NCSAuthenticator extends javax.mail.Authenticator

{

private String userName = null;

private String password = null;


public NCSAuthenticator(String userName, String password)

{

this.userName = userName;

this.password = password;

}

public javax.mail.PasswordAuthentication getPasswordAuthentication()

{

return new javax.mail.PasswordAuthentication(userName, password);

}

}

Re: Trouble to authentications vs SMTP server

Posted By:   John_Zukowski  
Posted On:   Wednesday, March 20, 2002 08:41 AM

As mentioned in the FAQ:


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

About | Sitemap | Contact