Hi, I did that as you suggested. It gave me this response:-
C:\>ping smtp-auth.iitb.ac.in Pinging smtp-auth.iitb.ac.in [10.200.1.125] with 32 bytes of data: Request timed out. Request timed out. Request timed out. Request timed out. Ping statistics for 10.200.1.125: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), =-------------------------------------------------- My Sys Admin told me that Ping will not work for smtp server (Dont know why, must be some protection policy), I tried ping using localhost:- --------------------------------------------------- C:\>ping localhost Pinging dil [127.0.0.1] with 32 bytes of data: Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Ping statistics for 127.0.0.1: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms --------------------------------------------------- so I tried telnet. ---------------------------------------------------- telnet smtp-auth.iitb.ac.in 25 In response, screen clears and I get this reply. 220 smtp-auth.iitb.ac.in ESMTP Postfix This means it is connecting here. Next I tried this :- C:\>telnet smtp-auth.iitb.ac.in 465 Connecting To smtp-auth.iitb.ac.in...Could not open connection to the host, on p ort 465: Connect failed ---------------------------------------------------- Does this mean I have to change the port to 25 to connect to the server.I tried that too in my code and I get this :- ------------------------------------------- C:\Program Files\Java\jdk1.5.0_10\bin>java javamailauth DEBUG: setDebug: JavaMail version 1.4.2 DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.s mtp.SMTPTransport,Sun Microsystems, Inc] DEBUG SMTP: useEhlo true, useAuth true DEBUG SMTP: useEhlo true, useAuth true DEBUG SMTP: trying to connect to host "smtp-auth.iitb.ac.in", port 25, isSSL fal se DEBUG SMTP: exception reading response: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? Exception in thread "main" javax.mail.MessagingException: Exception reading resp onse; nested exception is: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connecti on? at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java :1764) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1523) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:45 3) at javax.mail.Service.connect(Service.java:313) at javax.mail.Service.connect(Service.java:172) at javax.mail.Service.connect(Service.java:121) at javamailauth.test(javamailauth.java:44) at javamailauth.main(javamailauth.java:17) Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext conne ction? at com.sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(InputRec ord.java:521) at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:355) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.j ava:723) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SS LSocketImpl.java:1030) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketIm pl.java:678) at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java: 75) at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:106) at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) at java.io.BufferedInputStream.read(BufferedInputStream.java:235) at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:84) at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java :1742) ... 7 more C:\Program Files\Java\jdk1.5.0_10\bin> ----------------------------------------- Can somebody please tell me what is wrong or missing here. The code seems to be fine, there is some connection/settings issue. How do I resolve this problem? Thanks & Regards, Jitesh Dundas On Wed, Jul 22, 2009 at 1:25 AM, pacior <gpaty...@gmail.com> wrote: > The problem is that the host: smtp-auth.iitb.ac.in is not responding > now. > You can check that host is responding ( or not responding ) typing: > ping hostname in windows or linux operating system. > my smtp client: smtp.gmail.com is responding on that command. > > On Jul 21, 7:38 pm, jitesh dundas <jbdun...@gmail.com> wrote: > > Hi, > > > > Thanks for your reply. The smtp-server name seems to be fine. For > > authentication, I enter only the username and password. > > > > Though username/password are correct(this is my mail id/password for this > > institution), I am getting a feeling that the code is fine but there is > some > > issue in the credentials supplied(as you have pointed out). > > > > Any suggestions how I could check if my credentials are fine. > > > > Also, I have also got the Relay Access is denied error earlier. Should I > get > > a verification if the relay is allowed for my IP address. > > > > Any settings I need to take care of here. Also, how do I get them > checked. > > > > I request your reply. > > > > Thanks & Regards, > > Jitesh Dundas > > > > On Tue, Jul 21, 2009 at 8:23 PM, Mick Timony <mick.tim...@gmail.com> > wrote: > > > I see two problems. > > > > > The first is this: > > > > > javax.mail.SendFailedException: Invalid Addresses; > > > nested exception is: > > > com.sun.mail.smtp.SMTPAddressFailedException: 554 < > > > jit...@it.iitb.ac.in> > > > : Relay access denied > > > > > It's not recognising your credentials, so either your username/password > is > > > incorrect, or you need to use something else to authenticate. It's > possible > > > that you need to use just the username without the domain, or some > variation > > > on the domain. > > > > > The second one is this: > > > > > nested exception is: > > > com.sun.mail.smtp.SMTPAddressFailedException: 554 < > > > jbdun...@gmail.com>: > > > Relay access denied > > > > > Most servers disable "relay access" to prevent unauthorized users from > > > using their mail servers (to send spam). See this article on "Open > Relay" > > > for more details:http://en.wikipedia.org/wiki/Open_mail_relay. > > > > > Mick T. > > > > > On Tue, Jul 21, 2009 at 8:20 AM, jitesh dundas <jbdun...@gmail.com> > wrote: > > > > >> Hi Frends, > > > > >> I changed the port to 25 as this is the one used for sending emails. > Now I > > >> am getting this error:- > > > > >> C:\Program Files\Java\jdk1.5.0_10\bin>java Mailer > > >> There was an error in sending the mail. Please check the username, > > >> password and > > >> the mail-server information provided > > >> javax.mail.SendFailedException: Invalid Addresses; > > >> nested exception is: > > >> com.sun.mail.smtp.SMTPAddressFailedException: 554 < > > >> jit...@it.iitb.ac.in> > > >> : Relay access denied > > >> ; > > >> nested exception is: > > >> com.sun.mail.smtp.SMTPAddressFailedException: 554 < > > >> jbdun...@gmail.com>: > > >> Relay access denied > > > > >> at > com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1446) > > >> at > > >> com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:736) > > >> at javax.mail.Transport.send0(Transport.java:191) > > >> at javax.mail.Transport.send(Transport.java:120) > > >> at Mailer.postMail(Mailer.java:82) > > >> at Mailer.main(Mailer.java:30) > > >> Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 554 < > > >> jit...@it.iitb.ac. > > >> in>: Relay access denied > > >> ; > > >> nested exception is: > > >> com.sun.mail.smtp.SMTPAddressFailedException: 554 < > > >> jbdun...@gmail.com>: > > >> Relay access denied > > > > >> at > com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1344) > > >> ... 5 more > > >> Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 554 < > > >> jbdun...@gmail.com > > >> >: Relay access denied > > > > >> ... 6 more > > > > >> C:\Program Files\Java\jdk1.5.0_10\bin> > > > > >> Please help.. > > >> Thanks & Regards, > > >> Jitesh Dundas > > > > >> On Tue, Jul 21, 2009 at 3:54 PM, jitesh dundas <jbdun...@gmail.com > >wrote: > > > > >>> Hi, > > > > >>> This is another way I was trying to send my mail. Maybe you could > help me > > >>> out here. > > >>> We have an SMTP server(server name and other details are available). > I am > > >>> trying to send my mail via this server (and not gmail this time). > > > > >>> However, the code is compiling fine but gives a runtime error.Please > have > > >>> a look and tell me what is wrong. > > >>> ------------------------------------------ > > > > >>> Code:- > > > > >>> > --------------------------------------------------------------------------- > > >>> import javax.mail.*; > > >>> import javax.mail.internet.*; > > >>> import javax.mail.Authenticator; > > >>> import javax.mail.PasswordAuthentication; > > > > >>> import java.util.Properties; > > > > >>> public class javamailauth > > >>> { > > > > >>> private static final String SMTP_HOST_NAME = > "*********.****.**.**"; > > >>> private static final String SMTP_AUTH_USER = "******"; > > >>> private static final String SMTP_AUTH_PWD = "*******"; > > > > >>> public static void main(String[] args) throws Exception{ > > >>> new javamailauth().test(); > > >>> } > > > > >>> public void test() throws Exception{ > > >>> Properties props = new Properties(); > > >>> props.put("mail.transport.protocol", "smtp"); > > >>> props.put("mail.smtp.host", SMTP_HOST_NAME); > > >>> props.put("mail.smtp.port",80); > > >>> props.put("mail.smtp.auth", "true"); > > > > >>> Authenticator auth = new SMTPAuthenticator(); > > >>> Session mailSession = Session.getDefaultInstance(props, > auth); > > >>> // uncomment for debugging infos to stdout > > >>> // mailSession.setDebug(true); > > >>> Transport transport = mailSession.getTransport(); > > > > >>> MimeMessage message = new MimeMessage(mailSession); > > >>> message.setContent("This is a test", "text/plain"); > > >>> message.setFrom(new InternetAddress("jit...@it.iitb.ac.in > ")); > > >>> message.addRecipient(Message.RecipientType.TO,new > > >>> InternetAddress("jiteshbdun...@gmail.com")); > > > > >>> transport.connect(); > > >>> transport.sendMessage(message,message.getRecipients( > > >>> Message.RecipientType.TO)); > > >>> transport.close(); > > >>> } > > > > >>> private class SMTPAuthenticator extends javax.mail.Authenticator > { > > >>> public PasswordAuthentication getPasswordAuthentication() > > >>> { > > >>> String username = SMTP_AUTH_USER; > > >>> String password = SMTP_AUTH_PWD; > > >>> return new PasswordAuthentication(username, password); > > >>> } > > >>> } > > >>> } > > > > >>> > --------------------------------------------------------------------------- > > >>> Error:- > > > > >>> > --------------------------------------------------------------------------- > > >>> C:\Program Files\Java\jdk1.5.0_10\bin>java javamailauth > > >>> Exception in thread "main" javax.mail.MessagingException: Could not > > >>> connect to S > > >>> MTP host: smtp-auth.iitb.ac.in, port: 80; > > > > >>> nested exception is: > > >>> java.net.ConnectException: Connection timed out: connect > > >>> at > > >>> com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1545) > > >>> at > > >>> com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:45 > > >>> 3) > > >>> at javax.mail.Service.connect(Service.java:313) > > >>> at javax.mail.Service.connect(Service.java:172) > > >>> at javax.mail.Service.connect(Service.java:121) > > >>> at javamailauth.test(javamailauth.java:38) > > >>> at javamailauth.main(javamailauth.java:17) > > >>> Caused by: java.net.ConnectException: Connection timed out: connect > > >>> at java.net.PlainSocketImpl.socketConnect(Native Method) > > >>> at > java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) > > >>> at > > >>> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) > > >>> at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) > > >>> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) > > >>> at java.net.Socket.connect(Socket.java:519) > > >>> at java.net.Socket.connect(Socket.java:469) > > >>> at > > >>> com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:267) > > >>> at > > >>> com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:227) > > >>> at > > >>> com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1511) > > >>> ... 6 more > > > > >>> C:\Program Files\Java\jdk1.5.0_10\bin> > > > > >>> ------------------------------------------- > > > > >>> Note: For connecting to the internet, we use a UserName and Password > . > > >>> Once this is done, we can go and browse any page, include the mailing > > >>> websites( our institution mail box too). After this authentication, > we goto > > >>> the institution email website and enter our Email UserName and > Password. > > > > >>> Am I entering the credentials correctly. My PC's Ip Address has been > > >>> added to the MTA of the SMTP server. Thus the emails must be relayed > > >>> properly. > > > > >>> Please help. > > > > >>> Thanks & Regards, > > >>> Jitesh Dundas > > > > >>> On Fri, Jul 17, 2009 at 11:02 AM, Vasile Braileanu < > > >>> vasilebraile...@gmail.com> wrote: > > > > >>>> Hi, > > >>>> Did you use a SSL connection on port 465? > > > > >>>> Best regards, > > >>>> Vasile Braileanu > > > > > -- > > > Mick Timony > > > --- > > > Ever tried. Ever failed. No matter. Try Again. Fail again. Fail better. > -- > > > S. Beckett > > > --- > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en -~----------~----~----~----~------~----~------~--~---