Results 1 to 16 of 16
Thread: error in smpt.gmail.com host
- 08-01-2008, 05:06 PM #1
Member
- Join Date
- Aug 2008
- Posts
- 8
- Rep Power
- 0
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.
- 08-01-2008, 05:42 PM #2
How? Could you post the related code and the args that are causing the error.
- 08-01-2008, 06:37 PM #3
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
- 08-02-2008, 07:37 PM #4
Member
- Join Date
- Aug 2008
- Posts
- 8
- Rep Power
- 0
That is good help. but how can i check whether my computer is resolving stmp.gmail.com or not
- 08-03-2008, 07:03 AM #5
I told you how in my prior response:
"dig" and "nslookup" are programs.First, have you used dig or nslookup to verify that your computer can properly resolve smtp.gmail.com to a proper IP address?
Run them
- 08-04-2008, 01:57 PM #6
Member
- Join Date
- Aug 2008
- Posts
- 8
- Rep Power
- 0
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?
- 08-04-2008, 07:26 PM #7
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
- 08-06-2008, 08:55 AM #8
Member
- Join Date
- Aug 2008
- Posts
- 8
- Rep Power
- 0
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
- 08-06-2008, 10:07 AM #9
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
- 08-06-2008, 10:08 AM #10
sorry it was "gmail-smtp-in.l.google.com and "
To finish sooner, take your own time....
Nivedithaaaa
- 08-07-2008, 05:42 PM #11
Member
- Join Date
- Aug 2008
- Posts
- 8
- Rep Power
- 0
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.
- 08-07-2008, 08:39 PM #12
what do you get running dig or nslookup?
- 08-14-2008, 02:51 PM #13
Member
- Join Date
- Aug 2008
- Posts
- 8
- Rep Power
- 0
thank you !!! now it is working.
- 01-22-2009, 02:59 PM #14
Member
- Join Date
- Jan 2009
- Posts
- 2
- Rep Power
- 0
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");
- 07-07-2010, 11:36 AM #15
Member
- Join Date
- Jul 2010
- Posts
- 1
- Rep Power
- 0
i was getting the same error too..
try this one..it should work..this worked for me..
"gmail-smtp-msa.l.google.com"
- 03-10-2011, 06:25 PM #16
Member
- Join Date
- Mar 2011
- Posts
- 1
- Rep Power
- 0
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
-
How to access yahoo/gmail/hotmail address book
By shahinengg in forum AWT / SwingReplies: 3Last Post: 11-23-2009, 11:14 PM -
Looking Up the Address of a Host
By Java Tip in forum java.netReplies: 0Last Post: 04-07-2008, 08:11 PM -
Getting the host of the applet
By Java Tip in forum Java TipReplies: 0Last Post: 03-10-2008, 02:56 PM -
530 5.7.0 Authentication Required - JavaMail gmail
By simon in forum Advanced JavaReplies: 1Last Post: 07-14-2007, 11:52 PM -
Error with Sql 2000:java.net.NoRouteToHostException: No route to host: connect
By bbq in forum JDBCReplies: 0Last Post: 06-27-2007, 07:48 PM


LinkBack URL
About LinkBacks


Bookmarks