File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Distributed Java and the fly likes Java mail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Java mail" Watch "Java mail" New topic
Author

Java mail

Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Hi,

I am learning Java Mail in these days, started today. Luckily I don't have to install any if those API's because they are automatically available in the NetBeans IDE. But, I heard in order to that mail to work, we should have a mail server. What should I do here? Any free RECOMMENDED mail servers? Please help.


Are you better than me? Then please show me my mistakes..
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Apache James is an open source mail server written in Java.
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Tim Moores wrote:Apache James is an open source mail server written in Java.


Thanks for the help Tim Moores. I really appreciate it. Anyway, I just got to know, GMail also give the facility to use their server. What about that?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

Do not attempt to run your own SMTP server unless you thoroughly understand how internet e-mail works and are prepared to accept the responsibilities involved with that.

And if you don't have access to an SMTP server, then there really isn't any point in learning how to use JavaMail, is there? There won't be any practical application for the code you're going to write.
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Paul Clapham wrote:Do not attempt to run your own SMTP server unless you thoroughly understand how internet e-mail works and are prepared to accept the responsibilities involved with that.

And if you don't have access to an SMTP server, then there really isn't any point in learning how to use JavaMail, is there? There won't be any practical application for the code you're going to write.


Thanks for the reply Paul. OK, I dropped the idea of running my own mail server.

About that question about learning JAVA Mail, I have to do it actually, it is in our text books. But what they have given is an something like introduction, but I just wanted to go for more :)
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

I see. If it's part of your course work, then the school should naturally provide an SMTP server for you to practice on. I wouldn't expect a school to make students go out and find their own server, let alone make them set one up. Ask your teacher.
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

I asked. Unfortunately we don't have any server like that.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

Yohan Weerasinghe wrote:I asked. Unfortunately we don't have any server like that.


And are they expecting you to just write code, or do they expect you to test the code as well? If they are expecting you to find your own server to test on, then I must say I have a very low opinion of your school.
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Paul Clapham wrote:
Yohan Weerasinghe wrote:I asked. Unfortunately we don't have any server like that.


And are they expecting you to just write code, or do they expect you to test the code as well? If they are expecting you to find your own server to test on, then I must say I have a very low opinion of your school.


NONO!! As I mentioned above, it is an introduction. I am the person who is trying to go for more by my self
Duiltha Wijewantha
Greenhorn

Joined: Jan 12, 2012
Posts: 2
You can use Gmail to test out your Java mail code. But I haven't practically used it yet. You can get the Gmail configurations from this page. I encourage you for going out your way to get more of real practice in using Java Mail. It's the best way to learn anything.

PS: I am new to CodeRanch. Nice to meet everyone.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

Duiltha Wijewantha wrote:I am new to CodeRanch. Nice to meet everyone.


Welcome to the Ranch!
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Duiltha Wijewantha wrote:You can use Gmail to test out your Java mail code. But I haven't practically used it yet. You can get the Gmail configurations from this page. I encourage you for going out your way to get more of real practice in using Java Mail. It's the best way to learn anything.

PS: I am new to CodeRanch. Nice to meet everyone.


Hi, thanks a lot for your comment, it is very true, and I warmly welcome you to CodeRanch ..

jimmy Auction
Greenhorn

Joined: Jan 26, 2012
Posts: 5
JavaMail provides a common, uniform API for managing electronic mail. It allows
service-providers to provide a standard interface to their standards-based or
proprietary messaging systems using the Java programming language. Using this
API, applications access message stores, and compose and send messages.
paddy smith
Greenhorn

Joined: Mar 01, 2012
Posts: 3
please give full detail about javamail....

what is the goal of javamail???
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

paddy smith wrote:please give full detail about javamail....

what is the goal of javamail???


It is used to send and retrieve emails in the same way as all other emails do. You can have a email service for your local network as well as you can have a email service for your default email too, if the provider supports the activity by providing details.
paddy smith
Greenhorn

Joined: Mar 01, 2012
Posts: 3
Thank you for your quick reply.

I can do understand.......
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

paddy smith wrote:Thank you for your quick reply.

I can do understand.......


You are welcome
Piyush Doraya
Greenhorn

Joined: Feb 21, 2012
Posts: 5
Yohan Weerasinghe wrote:
paddy smith wrote:Thank you for your quick reply.

I can do understand.......


You are welcome


Hi All,

Can any of you provide info on following issue :

I created API to put mail on external SMTP server. On running the code following issue has been observed:

javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
boundary="----=_Part_0_1731747840.1331020495293"
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:877)
at javax.activation.DataHandler.writeTo(DataHandler.java:302)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1476)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1772)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1099)
at javax.mail.Transport.send0(Transport.java:195)
at javax.mail.Transport.send(Transport.java:124)
at SMTPAuthenticator.main(SMTPAuthenticator.java:82)
javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
boundary="----=_Part_0_1731747840.1331020495293"
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1141)
at javax.mail.Transport.send0(Transport.java:195)
at javax.mail.Transport.send(Transport.java:124)
at SMTPAuthenticator.main(SMTPAuthenticator.java:82)
Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
boundary="----=_Part_0_1731747840.1331020495293"
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:877)
at javax.activation.DataHandler.writeTo(DataHandler.java:302)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1476)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1772)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1099)
... 3 more

Logs Observed on the console:

DEBUG: JavaMail version 1.4.4
DEBUG: failed to load any providers, using defaults
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.,1.4.4], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc.,1.4.4], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc.,1.4.4], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.
un.mail.pop3.POP3SSLStore,Sun Microsystems, Inc.,1.4.4], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc.,1.4.4], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc.,1.4.4]}
DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc.,1.4.4], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc.,1.4.4], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc.,1.4.4], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc.,1.4.4], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPT
ansport,Sun Microsystems, Inc.,1.4.4], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc.,1.4.4]}
DEBUG: failed to load address map, using defaults
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc.,1.4.4]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "<SMTP Host>", port 25, isSSL false
220 dcdelexc01.Eichergroup.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready at Tue, 6 Mar 2012 13:24:55 +0530
DEBUG SMTP: connected to host "<SMTP Host>", port: 25

EHLO <Server Name>
250-<Server Name> Hello [<Server Name>]
250-TURN
250-SIZE
250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250-X-EXPS GSSAPI NTLM LOGIN
250-X-EXPS=LOGIN
250-AUTH GSSAPI NTLM LOGIN
250-AUTH=LOGIN
250-X-LINK2STATE
250-XEXCH50
250 OK
DEBUG SMTP: Found extension "TURN", arg ""
DEBUG SMTP: Found extension "SIZE", arg ""
DEBUG SMTP: Found extension "ETRN", arg ""
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "DSN", arg ""
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "8bitmime", arg ""
DEBUG SMTP: Found extension "BINARYMIME", arg ""
DEBUG SMTP: Found extension "CHUNKING", arg ""
DEBUG SMTP: Found extension "VRFY", arg ""
DEBUG SMTP: Found extension "X-EXPS", arg "GSSAPI NTLM LOGIN"
DEBUG SMTP: Found extension "X-EXPS=LOGIN", arg ""
DEBUG SMTP: Found extension "AUTH", arg "GSSAPI NTLM LOGIN"
DEBUG SMTP: Found extension "AUTH=LOGIN", arg ""
DEBUG SMTP: Found extension "X-LINK2STATE", arg ""
DEBUG SMTP: Found extension "XEXCH50", arg ""
DEBUG SMTP: Found extension "OK", arg ""
DEBUG SMTP: Attempt to authenticate
DEBUG SMTP: check mechanisms: LOGIN PLAIN DIGEST-MD5 NTLM
AUTH LOGIN
334 VXNlcm5hbWU6
ZG9ub3RyZXBseQ==
334 UGFzc3dvcmQ6
cEBzc3cwcmQ=
235 2.7.0 Authentication successful.
DEBUG SMTP: use8bit false
MAIL FROM:<yourname@hostname> AUTH=donotreply
250 2.1.0 yourname@hostname....Sender OK
RCPT TO:<yourname@gmail.com>
250 2.1.5 yourname@gmail.com
DEBUG SMTP: Verified Addresses
DEBUG SMTP: yourname@gmail.com
DATA
354 Start mail input; end with <CRLF>.<CRLF>
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java mail