• 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
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

SMTP(Simple Mail Transer Protocol)

 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi i have to use SMTP in my proj but i have no idea how to use it, how to get the connection, how to make the setup and how to send the mails through it.
But i know that for this we need to import the class com.jscape.inet.smtp ,but its not a part of J2SE or J2EE where to get this package?
Do we have to download any thing for this separately or do we have to include any Jar file for this? Please help me!!
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

But i know that for this we need to import the class com.jscape.inet.smtp



Why? Java has had an official Mail API for years.

See the official Mail API site.

Bill
 
Bharadwaj Adepu
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes!! thanks williams. Ive downloaded the jar files from the website and compiled the program, it compiled fine but its throwing errors while running!!

And what is the file javamail.address.map? it gives a file not found exception for this!!

DEBUG: JavaMail version 1.4.1
DEBUG: not loading file: C:\Program Files\Java\jdk1.5.0\jre\lib\javamail.providers
DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.5.0\jre\lib\javamail.providers (The system cannot find the file specified)
DEBUG: URL jar:file:/C:/Program%20Files/Java/jdk1.5.0/jre/lib/smtp.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: jar:file:/C:/Program%20Files/Java/jdk1.5.0/jre/lib/smtp.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
DEBUG: Tables of loaded providers
DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}
DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
DEBUG: URL jar:file:/C:/Program%20Files/Java/jdk1.5.0/jre/lib/smtp.jar!/META-INF/javamail.address.map
DEBUG: successfully loaded resource: jar:file:/C:/Program%20Files/Java/jdk1.5.0/jre/lib/smtp.jar!/META-INF/javamail.address.map
DEBUG: not loading file: C:\Program Files\Java\jdk1.5.0\jre\lib\javamail.address.map
DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.5.0\jre\lib\javamail.address.map (The system cannot find the file specified)
DEBUG: setDebug: JavaMail version 1.4.1
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL false
Exception in thread "main" javax.mail.MessagingException: Unknown SMTP host: smtp.gmail.com;
nested exception is:
java.net.UnknownHostException: smtp.gmail.com
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1389)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
at javax.mail.Service.connect(Service.java:310)
at javax.mail.Service.connect(Service.java:169)
at javax.mail.Service.connect(Service.java:118)
at javax.mail.Transport.send0(Transport.java:188)
at javax.mail.Transport.send(Transport.java:118)
at general.GoogleTest.sendSSLMessage(GoogleTest.java:76)
at general.GoogleTest.main(GoogleTest.java:35)
Caused by: java.net.UnknownHostException: smtp.gmail.com
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:520)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:545)
at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:141)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:233)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:163)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1359)
... 8 more
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I think what that is saying is that it could not connect to that host, therefore it tried to find other providers. I have not seen that error, but I am guessing that it would be up to the programmer to create the list of alternate providers in a file named "javamail.providers"

Bill
 
Sheriff
Posts: 28371
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, all those messages that appear to be about "providers" are simply attempts to find various internal files in a list of standard places. The meaning of the message is that the code couldn't connect to smtp.gmail.com, nothing more than that.
 
Bharadwaj Adepu
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is my problem!! why is the code not able to connect to smtp.gmail.com?
do we have to setup an SMTP server with that name for ourselves?

and even ive tried to deploy the examples e.g. javamail.war but i coudn'nt run the example the first login page is getting opened

Welcome to JavaMail
HTML Email Reader Demo
IMAP Hostname:

Username:

Password:



but i could not go furthur when i click Login am getting an error

The page cannot be displayed
HTTP 500 - Internal server error
Internet Explorer


What could be the problem?
 
Hey! Wanna see my flashlight? It looks like this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic