Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java API
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Eclipse Collections Categorically: Level up your programming game
this week in the
Open Source Projects
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Ron McLeod
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Other JSE/JEE APIs
Couldn't get Message List: Connect failed?!
lyo Yashnoo
Ranch Hand
Posts: 50
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi everyone:
I want to get Mail list using javamail API. My code is:
Properties prop=new Properties(); prop.put("mail.pop3.host",host); prop.put("mail.smtp.auth","true");// Session session=Session.getDefaultInstance(prop); session.setDebug(true); Store store=session.getStore("pop3"); store.connect(host,name,password); Folder inbox=store.getDefaultFolder().getFolder("INBOX"); inbox.open(Folder.READ_ONLY); Message[] msg=inbox.getMessages(); FetchProfile profile=new FetchProfile(); profile.add(FetchProfile.Item.ENVELOPE); inbox.fetch(msg,profile); return(msg);
When I run it. Exception happen:
DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc] POP3: connecting to host "pop3.sina.com", port 110 javax.mail.MessagingException: Connect failed; nested exception is: java.net.UnknownHostException: pop3.sina.com at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:106) at javax.mail.Service.connect(Service.java:234) at javax.mail.Service.connect(Service.java:135) at com.developcentry.mail.MailTest.getMail(MailTest.java:45) at com.developcentry.mail.MailTest.getMsgList(MailTest.java:66) at com.developcentry.mail.MailTest.main(MailTest.java:61) Exception in thread "main"
My username and password is correct. Maybe I need set proxy to javamail. How to set proxy using javamail for get Mail list? THks!
asnmurthy
Greenhorn
Posts: 7
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
try run like this
java
-DsocksProxyHost=<Your Proxy IP address> <your program name>
Regards,
Murthy
Thanks & Regards,<br />Murthy
please buy this thing and then I get a fat cut of the action:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Java Mail send message to Yahoo account
Reading Java Mail
connecting to gmail pop3 server
unknownhost Exception
JavaMail and security
More...