GeeCON Prague 2014*
The moose likes Other JSE/JEE APIs and the fly likes javaMail question ( the same as previous topic with source code) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "javaMail question ( the same as previous topic with source code)" Watch "javaMail question ( the same as previous topic with source code)" New topic
Author

javaMail question ( the same as previous topic with source code)

Yurong Chen
Greenhorn

Joined: Jul 23, 2002
Posts: 18
Hello, I use javaMail for my javabean to send email in my web server. However I got the following error message when I compile it.:

my javabean Email.java has the source code as followed:


My application FinishRegister.jsp have the followed source code:


Thank you in advanced!
Yurong Chen
[ June 22, 2006: Message edited by: Ulf Dittmer ]
Stu Glassman
Ranch Hand

Joined: Jul 01, 2002
Posts: 91
It looks like you need to add the path of com.sun.mail.util.BEncoderStream to your server's classpath.
-Stu
Yurong Chen
Greenhorn

Joined: Jul 23, 2002
Posts: 18
It is the problem! Thank you ! I ignored that package when I imported the javax.*.
However, I met a new problem now. I sent out the message without any error now. But I didn't receive the email in the destination email address. I wrote a test program for that and got the following message:

Could you help me to explain that?
Thanks in advance!
Yurong
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
Yurong.. this is not an answer to your problem... i don't know... .. but after looking at your code, have you tried using JSTL to send email?, it is BEAUTIFUL... I think it is called mailer taglib. I've used and it's great!
cheers


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Ankur Goyal
Greenhorn

Joined: Feb 04, 2002
Posts: 13
Include com.sun.mail.handler package in ur class path.


Let me know if I am wrong ! <img src="smile.gif" border="0">
Yurong Chen
Greenhorn

Joined: Jul 23, 2002
Posts: 18
Dear Andres and Ankur,

I think my problem is on setting the environment variables. However, I have set the package into my classpath. It still gave me the error message when I compiled the program:

Should I put the source code of my program here? It is a little long.


Thank you for your kind help!

Yurong
[ June 22, 2006: Message edited by: Ulf Dittmer ]
Yurong Chen
Greenhorn

Joined: Jul 23, 2002
Posts: 18
Dear Andres,
I want to try the JSTL to send email after my program running. It should be brilliant. I need time to learn that.
Yurong
Yurong Chen
Greenhorn

Joined: Jul 23, 2002
Posts: 18
Dear All,
Thank you very much! I have solved the problem in Windows. However, I am still trying to set the right path in my web server.
Yurong
Priya Vasudevan
Greenhorn

Joined: Mar 19, 2004
Posts: 17
Hi,

I encounter a similar problem when i send a e-mail form my SMTP code.I am suing mail.jar(version 1.3.2) and activation.jar(version 1.0.2)- doenloaded from sun's site.And i have included it in the class-path.

This is the stackTrace i get when i set session.setDebug(true).
Pls. do let me know how you resolved it.



Regards,
priya

[ UD: added CODE tags ]
[ June 22, 2006: Message edited by: Ulf Dittmer ]
Benson Fung
Ranch Hand

Joined: Apr 10, 2003
Posts: 208
Hi Yurong,

could you let us know how you solved the problem? I also got the same problem.


Thanks
Benson
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42024
    
  64
Just having mail.jar and activation.jar in your classpath is sufficient for compiling, but not for runtime. Depending on which protocols you use, you need some or all of smtp.jar, pop3.jar and imap.jar.


Ping & DNS - my free Android networking tools app
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Originally posted by Ulf Dittmer:
Just having mail.jar and activation.jar in your classpath is sufficient for compiling, but not for runtime. Depending on which protocols you use, you need some or all of smtp.jar, pop3.jar and imap.jar.
I don't believe this is correct. I have only mail.jar and activation.jar in my classpath at runtime and this works fine for SMTP and IMAP. I expect it would work for POP as well. My understanding is that smtp.jar and so on are extracts from mail.jar that you can use if having smaller jar files is important to you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javaMail question ( the same as previous topic with source code)