?
Solved

JavaMail

Posted on 2005-03-02
12
Medium Priority
?
486 Views
Last Modified: 2013-11-24
I am using J2EE.
Anyone can provide sample codes using JavaMail to send an email?


hongjun
0
Comment
Question by:hongjun
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
  • +1
12 Comments
 
LVL 37

Accepted Solution

by:
zzynx earned 1000 total points
ID: 13440442
0
 
LVL 37

Expert Comment

by:zzynx
ID: 13440474
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 5

Expert Comment

by:Naeemg
ID: 13440829
0
 
LVL 33

Author Comment

by:hongjun
ID: 13442195
I got NoClassDefFoundError.
I am suspecting my classpath is incorrect for javamail.

hongjun
0
 
LVL 33

Author Comment

by:hongjun
ID: 13442233
BTW, I have included activation.jar and mail.jar but still not working.
I am using this code
http://www.javaworld.com/javaworld/jw-10-2001/jw-1026-javamail.html
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13442288
Which class is not being found? The mail ones or the main class? Have you checked the package declaration?
0
 
LVL 33

Author Comment

by:hongjun
ID: 13442320
Thanks I got it to work.
However, I do have some queries.

The code example shows that you just need to include a smtp server address. However, username and password are omitted. I would prefer to enter them. Can help?

hongjun
0
 
LVL 33

Author Comment

by:hongjun
ID: 13442462
How to set a classpath in NetBeans?
It doesn't seem to be able to compile using netbeans because of classpath problem.

hongjun
0
 
LVL 29

Assisted Solution

by:bloodredsun
bloodredsun earned 1000 total points
ID: 13442491
When you connect to the Transport you can pass a username and password:

Transport transport =   session.getTransport("smtp");
transport.connect( host, username, password);

and you may need to add this line to the properties section
props.put("mail.smtp.auth", "true");
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13442508
If it's anything like Eclipse, right click on the project and select Java/build Path/ add jars
0
 
LVL 37

Expert Comment

by:zzynx
ID: 13447403
>> How to set a classpath in NetBeans?
In netBeans you have to mount a jar to make it "available"

Thanks for accepting
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question