A
ameyas7
hi all,
i wrote a simple program as follows.
i am trying to send mail through SMTP server.
i have set the following property to true
props.put("mail.smtp.auth", "true");
Transport transport = session.getTransport("smtp");
transport.connect("localhost", "(e-mail address removed)", "");
transport.sendMessage(message,addr);
transport.close();
javax.mail.AuthenticationFailedException
at javax.mail.Service.connect(Service.java:264)
at javax.mail.Service.connect(Service.java:134)
at sendmail.EMailHandler.send(EMailHandler.java:53)
at sendmail.demo.SendMailDemo.main(SendMailDemo.java:11)
i am not sure which username and password we need to provide while
connecting to the server.
i have installed hMailServer i tried using Administrator password for
server but did not work.
i tried using the from mail a/c user name , password but no luck.
can someone tell me what am i missing here ? which username , password
do we need to give. do we need any specific setting on smtp server ?
any example ?
On setting DEBUG true i get the following trace from the SMTP server.
DEBUG: setDebug: JavaMail version 1.3.2
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 "localhost", port 25, isSSL
false
220 USER-E1B9B7EDB6 ESMTP
DEBUG SMTP: connected to host "localhost", port: 25
EHLO user-e1b9b7edb6
250-hmailserver
250-SIZE
250 AUTH LOGIN PLAIN
DEBUG SMTP: Found extension "SIZE", arg ""
DEBUG SMTP: Found extension "AUTH", arg "LOGIN PLAIN"
DEBUG SMTP: Attempt to authenticate
AUTH LOGIN
334 VXNlcm5hbWU6
cm9vdEBsb2NhbGhvc3QuY29t
334 UGFzc3dvcmQ6
535 Authentication failed. Restarting authentication process.
javax.mail.AuthenticationFailedException
at javax.mail.Service.connect(Service.java:264)
at javax.mail.Service.connect(Service.java:134)
at sendmail.EMailHandler.send(EMailHandler.java:54)
at sendmail.demo.SendMailDemo.main(SendMailDemo.java:11)
thanks
amey
i wrote a simple program as follows.
i am trying to send mail through SMTP server.
i have set the following property to true
props.put("mail.smtp.auth", "true");
Transport transport = session.getTransport("smtp");
transport.connect("localhost", "(e-mail address removed)", "");
transport.sendMessage(message,addr);
transport.close();
javax.mail.AuthenticationFailedException
at javax.mail.Service.connect(Service.java:264)
at javax.mail.Service.connect(Service.java:134)
at sendmail.EMailHandler.send(EMailHandler.java:53)
at sendmail.demo.SendMailDemo.main(SendMailDemo.java:11)
i am not sure which username and password we need to provide while
connecting to the server.
i have installed hMailServer i tried using Administrator password for
server but did not work.
i tried using the from mail a/c user name , password but no luck.
can someone tell me what am i missing here ? which username , password
do we need to give. do we need any specific setting on smtp server ?
any example ?
On setting DEBUG true i get the following trace from the SMTP server.
DEBUG: setDebug: JavaMail version 1.3.2
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 "localhost", port 25, isSSL
false
220 USER-E1B9B7EDB6 ESMTP
DEBUG SMTP: connected to host "localhost", port: 25
EHLO user-e1b9b7edb6
250-hmailserver
250-SIZE
250 AUTH LOGIN PLAIN
DEBUG SMTP: Found extension "SIZE", arg ""
DEBUG SMTP: Found extension "AUTH", arg "LOGIN PLAIN"
DEBUG SMTP: Attempt to authenticate
AUTH LOGIN
334 VXNlcm5hbWU6
cm9vdEBsb2NhbGhvc3QuY29t
334 UGFzc3dvcmQ6
535 Authentication failed. Restarting authentication process.
javax.mail.AuthenticationFailedException
at javax.mail.Service.connect(Service.java:264)
at javax.mail.Service.connect(Service.java:134)
at sendmail.EMailHandler.send(EMailHandler.java:54)
at sendmail.demo.SendMailDemo.main(SendMailDemo.java:11)
thanks
amey