sending mail with authentication
843830Jan 8 2004 — edited Nov 22 2004Dear All,
I am trying to send mail with authentication. My Mail server requires username and password while sending mails from Netscape.
But when I am sending mail through java mail api, I can send email with wrong username and password.
Actually when I enable debug, I am getting the following prints.
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG: SMTPTransport trying to connect to host "vkarthik.net.com", port 25
DEBUG SMTP RCVD: 220 vkarthik.net.com ESMTP Sendmail 8.12.5/8.12.5; Thu, 8 Jan 2004 21:04:59 +0530
DEBUG SMTP SENT: helo saravanakumar.net.com
DEBUG SMTP RCVD: 250 vkarthik.net.com Hello saravanakumar [192.168.4.50], pleased to meet you
DEBUG: SMTPTransport connected to host "vkarthik.net.com", port: 25
DEBUG SMTP SENT: NOOP
DEBUG SMTP RCVD: 250 2.0.0 OK
DEBUG SMTP SENT: mail from: <saravanakumar@net.com>
DEBUG SMTP RCVD: 250 2.1.0 <saravanakumar@net.com>... Sender ok
DEBUG SMTP SENT: rcpt to: <vkarthik>
DEBUG SMTP RCVD: 250 2.1.5 <vkarthik>... Recipient ok
Verified Addresses
vkarthik
DEBUG SMTP SENT: data
DEBUG SMTP RCVD: 354 Enter mail, end with "." on a line by itself
DEBUG SMTP SENT:
.
DEBUG SMTP RCVD: 250 2.0.0 i08FYxbY017757 Message accepted for delivery
I set mail.smtp.auth as true correctly.
When I browse through this forum I found that authentication is performed If we get debug prints as follows.
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG: SMTPTransport trying to connect to host "smtp.mail.yahoo.com", port 25
DEBUG SMTP RCVD: 220 smtp011.mail.yahoo.com ESMTP
DEBUG: SMTPTransport connected to host "smtp.mail.yahoo.com", port: 25
DEBUG SMTP SENT: EHLO wva24-d9kzst01
DEBUG SMTP RCVD: 250-smtp011.mail.yahoo.com
250-AUTH=LOGIN PLAIN
250-PIPELINING
250 8BITMIME
DEBUG SMTP Found extension "AUTH=LOGIN", arg "PLAIN"
DEBUG SMTP Found extension "PIPELINING", arg ""
DEBUG SMTP Found extension "8BITMIME", arg ""
DEBUG SMTP: Attempt to authenticate
DEBUG SMTP use AUTH=LOGIN hack
DEBUG SMTP SENT: AUTH LOGIN
DEBUG SMTP RCVD: 334 VXNlcm5hbWU6
I guess the following statement is missing in my case.
DEBUG SMTP: useEhlo true, useAuth true
Could You please let me know why I am not getting this? Am I doing something wrong in my code?
Or it is a problem in the mail server?
Thanking you,
Saravanakumar