Meaningless Drivel is fun!*
The moose likes Other JSE/JEE APIs and the fly likes 530 5.7.1 Client was not authenticated Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "530 5.7.1 Client was not authenticated" Watch "530 5.7.1 Client was not authenticated" New topic
Author

530 5.7.1 Client was not authenticated

Priyam Srivastava
Ranch Hand

Joined: Oct 29, 2006
Posts: 169
Hi,

While sending Email... I keep getting error:

530 5.7.1 Client was not authenticated

Initially I thought that the "fromaddress" that I am using requires an authentication. But that is not the case. It has been configured to send mail without any authentication. Then when I changed the configuration to enabled authentication, I am still getting the same error. I am putting the whole SMTP Debug as well as my code here. Note that my user id for authentication is same as "from address" i.e. xxxxx@abcd.com

DEBUG: setDebug: JavaMail version 1.4.1
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "192.168.21.223", port 25, isSSL false
220 MAIL1.XXXX.INT Microsoft ESMTP MAIL Service ready at Mon, 23 Jan 2012 18:23:56 +0200
DEBUG SMTP: connected to host "192.168.21.223", port: 25

EHLO venus02
250-MAIL1.XXXX.INT Hello [10.160.1.110]
250-SIZE
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-X-ANONYMOUSTLS
250-AUTH NTLM
250-X-EXPS GSSAPI NTLM
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250-XEXCH50
250-XRDST
250 XSHADOW
DEBUG SMTP: Found extension "SIZE", arg ""
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "DSN", arg ""
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "STARTTLS", arg ""
DEBUG SMTP: Found extension "X-ANONYMOUSTLS", arg ""
DEBUG SMTP: Found extension "AUTH", arg "NTLM"
DEBUG SMTP: Found extension "X-EXPS", arg "GSSAPI NTLM"
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "BINARYMIME", arg ""
DEBUG SMTP: Found extension "CHUNKING", arg ""
DEBUG SMTP: Found extension "XEXCH50", arg ""
DEBUG SMTP: Found extension "XRDST", arg ""
DEBUG SMTP: Found extension "XSHADOW", arg ""
DEBUG SMTP: Attempt to authenticate
NOOP
250 2.0.0 OK
DEBUG SMTP: use8bit false
MAIL FROM:<xxxxx@abcd.com>
530 5.7.1 Client was not authenticated
DEBUG SMTP: got response code 530, with response: 530 5.7.1 Client was not authenticated

RSET
DEBUG SMTP: EOF: [EOF]
javax.mail.MessagingException: [EOF]
at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:1481)
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1512)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1055)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:634)
at com.pack.prod.infra.JFMailer.sendMail(JFMailer.java:843)


My Java code goes like this:


Any idea what I am doing wrong. Once again with authentication and no authentication, I keep getting this same error.

Regards,
Priyam


"History would be kind to me, for I intend to write it."
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18886
    
    8

What do you mean, with authentication? There is no authentication in that code. Have a look at the JavaMail FAQ, where you'll find an example of how to do it.
Priyam Srivastava
Ranch Hand

Joined: Oct 29, 2006
Posts: 169
Referring to Java doc link that you posted:

You need to authenticate to your SMTP server. The package javadocs for the com.sun.mail.smtp package describe several methods to do this. The easiest is often to replace the call Transport.send(msg); with

String protocol = "smtp";
props.put("mail." + protocol + ".auth", "true");
...
Transport t = session.getTransport(protocol);
try {
t.connect(username, password);
t.sendMessage(msg, msg.getAllRecipients());
} finally {
t.close();
}



Ain't I doing the same thing:
smtpTransport.connect (smtpSession.getProperty ("mail.smtp.host"), 25, l_user, l_passwd);
....
smtpTransport.sendMessage (l_smtp_message,l_smtp_message.getAllRecipients());

only difference being which overloaded connect method I am using? Or am I missing something?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18886
    
    8

Priyam Srivastava wrote:...only difference being which overloaded connect method I am using? Or am I missing something?


Yes. The code you showed from the FAQ provides a user ID and password. Your code (which the server doesn't believe authenticates) does not provide a user ID and password. Do you think that is an insignificant difference?
Priyam Srivastava
Ranch Hand

Joined: Oct 29, 2006
Posts: 169
If You are referring to variable l_user, l_passwd then this is getting populated from my Properties file for which I haven't pasted the code here.
l_user = xxxxx@abdc.com
l_passwd = xxxxxxxx
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18886
    
    8

No, of course just setting variables in your code to the user ID and password wouldn't cause authentication with the SMTP server. So no, I wasn't referring to that. I was referring to the total absence of any code where you pass that information to the server. Or if you do, I can't see it. (My apologies if it's actually there -- I find your code very hard to read with all those strange variable names.)

But you've seen the example code. It works. Your code is different, and it doesn't work. I know what I would do in that case. I'm surprised you haven't done it yourself already.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 530 5.7.1 Client was not authenticated