Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Yurong Chen
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you need to add the path of com.sun.mail.util.BEncoderStream to your server's classpath.
-Stu
 
Yurong Chen
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ankur Goyal
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Include com.sun.mail.handler package in ur class path.
 
Yurong Chen
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Yurong,

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


Thanks
Benson
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Clapham
Sheriff
Pie
Posts: 20764
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic