Results 1 to 16 of 16
  1. #1
    kib_tse is offline Member
    Join Date
    Aug 2008
    Posts
    8
    Rep Power
    0

    Smile error in smpt.gmail.com host

    I've been testing some code for sending secure e-mail, and I've been using my Gmail account for testing.
    but when I run it i am getting this
    DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL false
    Unknown SMTP host: smtp.gmail.com;

    so please help me.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,332
    Rep Power
    25

    Default

    How? Could you post the related code and the args that are causing the error.

  3. #3
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by kib_tse View Post
    I've been testing some code for sending secure e-mail, and I've been using my Gmail account for testing.
    but when I run it i am getting this
    DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL false
    Unknown SMTP host: smtp.gmail.com;

    so please help me.
    First, have you used dig or nslookup to verify that your computer can properly resolve smtp.gmail.com to a proper IP address?

    That is the problem resulting in the "unknown host" error

    Then check that you really want port 465 instead of the standard 25.

    Then check your firewall, since its unusual to have 465 open

  4. #4
    kib_tse is offline Member
    Join Date
    Aug 2008
    Posts
    8
    Rep Power
    0

    Default

    That is good help. but how can i check whether my computer is resolving stmp.gmail.com or not

  5. #5
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    I told you how in my prior response:
    First, have you used dig or nslookup to verify that your computer can properly resolve smtp.gmail.com to a proper IP address?
    "dig" and "nslookup" are programs.
    Run them

  6. #6
    kib_tse is offline Member
    Join Date
    Aug 2008
    Posts
    8
    Rep Power
    0

    Default not familair with nslookup and dig

    thank you but
    I am not familiar with dig and nslookup.
    but istead i wrote a code that take the hostname as an input and give host address as a result.
    I have run the code like this
    D:/> Enter host name: smtp.gmail.com
    Ip address is 64.233.179.109

    what is this? is my computer resolving or not?

  7. #7
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by kib_tse View Post
    I am not familiar with dig and nslookup.
    The first rule of programming is to be able to know where the bugs are. If you are writing networking code, you will calling code to do things like resolve names, open ports, etc.

    In order to know if your code is working or not, the easiest thing to do is use a known working utility that does parts of the same thing.

    learn to use nslookup and dig
    learn to use telnet
    learn to use telnet with various port numbers

  8. #8
    kib_tse is offline Member
    Join Date
    Aug 2008
    Posts
    8
    Rep Power
    0

    Default STMP erorr

    i have run this code :
    package javaapplication14;
    import java.io.*;
    import java.net.InetAddress;
    import java.util.Properties;
    import java.util.Date;

    import javax.mail.*;
    import javax.mail.internet.*;


    /**
    *
    * @author project
    */
    public class SendMail {

    public static void main(String[] argv) throws Exception{

    String host = "smtp.gmail.com";
    String from = "kibtse@gmail.com";
    String to = "kib_tse@gmail.com";

    // Get system properties
    Properties props = System.getProperties();

    // Setup mail server
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.starttls.enable", "true");
    props.put("mail.smtp.auth", "true");

    // Get session
    Authenticator auth = new MyAuthenticator();
    Session session = Session.getDefaultInstance(props, auth);

    // Define message
    MimeMessage message = new MimeMessage(session);
    message.setFrom(new InternetAddress(from));
    message.addRecipient(Message.RecipientType.TO,
    new InternetAddress(to));
    message.setSubject("Hello ");
    message.setText("Welcome to gmail");

    // Send message
    Transport.send(message);
    }
    }

    class MyAuthenticator extends Authenticator
    {
    MyAuthenticator() { super(); }

    protected PasswordAuthentication getPasswordAuthentication()
    { return new PasswordAuthentication("kibtse", "pwd"); }
    }
    and i have included mail.jar and activation.jar. but i am geting this error
    Exception in thread "main" javax.mail.MessagingException: Can't send command to SMTP host;
    nested exception is:
    javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: timestamp check failed
    at com.sun.mail.smtp.SMTPTransport.sendCommand(Unknow n Source)
    at com.sun.mail.smtp.SMTPTransport.sendCommand(Unknow n Source)

    please help me

  9. #9
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    Why dont you try with other hosts like gmail-smtp.l.google.com or gmail-smtp-in.l.google.comans check if you are getting the same error?
    To finish sooner, take your own time....
    Nivedithaaaa

  10. #10
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    sorry it was "gmail-smtp-in.l.google.com and "
    To finish sooner, take your own time....
    Nivedithaaaa

  11. #11
    kib_tse is offline Member
    Join Date
    Aug 2008
    Posts
    8
    Rep Power
    0

    Default I tried using "gmail-smtp-in.l.google.com"

    I tried with "gmail-smtp-in.l.google.com" i am getting the same error
    like:
    Exception in thread "main" javax.mail.MessagingException: Unknown SMTP host: gma
    il-smtp-in.l.google.com ;
    nested exception is:
    java.net.UnknownHostException: gmail-smtp-in.l.google.com
    at com.sun.mail.smtp.SMTPTransport.openServer(Unknown Source)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(Un known Source)
    at javax.mail.Service.connect(Unknown Source)
    at javax.mail.Service.connect(Unknown Source)
    at javax.mail.Service.connect(Unknown Source)
    at com.sun.mail.smtp.SMTPTransport.connect(Unknown Source)
    at javax.mail.Transport.send0(Unknown Source)
    at javax.mail.Transport.send(Unknown Source)
    at SendMail.main(SendMail.java:38)
    what is the problem?
    Last edited by kib_tse; 08-07-2008 at 05:46 PM.

  12. #12
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    what do you get running dig or nslookup?

  13. #13
    kib_tse is offline Member
    Join Date
    Aug 2008
    Posts
    8
    Rep Power
    0

    Default

    thank you !!! now it is working.

  14. #14
    extempore is offline Member
    Join Date
    Jan 2009
    Posts
    2
    Rep Power
    0

    Default

    Kindly add the following line of code in your property file

    props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
    props.put("mail.smtp.socketFactory.fallback", "false");

  15. #15
    atripavan is offline Member
    Join Date
    Jul 2010
    Posts
    1
    Rep Power
    0

    Default

    i was getting the same error too..
    try this one..it should work..this worked for me..
    "gmail-smtp-msa.l.google.com"

  16. #16
    jetinder20 is offline Member
    Join Date
    Mar 2011
    Posts
    1
    Rep Power
    0

    Default java.net.UnknownHostException: smtp.gmail.com

    hi,
    even i tried same thing and getting same exception i.e java.net.UnknownHostException: smtp.gmail.com

    and when i ran nslookup

    >nslookup gmail.com
    Server: UnKnown
    Address: fec0:0:0:ffff::1

    *** UnKnown can't find gmail.com: No response from server
    this is the response i m getting...
    please help me resolve the issue..

    regards

Similar Threads

  1. How to access yahoo/gmail/hotmail address book
    By shahinengg in forum AWT / Swing
    Replies: 3
    Last Post: 11-23-2009, 11:14 PM
  2. Looking Up the Address of a Host
    By Java Tip in forum java.net
    Replies: 0
    Last Post: 04-07-2008, 08:11 PM
  3. Getting the host of the applet
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-10-2008, 02:56 PM
  4. 530 5.7.0 Authentication Required - JavaMail gmail
    By simon in forum Advanced Java
    Replies: 1
    Last Post: 07-14-2007, 11:52 PM
  5. Replies: 0
    Last Post: 06-27-2007, 07:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •