Installing JavaMail using Eclipse JavaSE 1.6

Someone please explain to me how to properly install JavaMail and get it to execute in Eclipse please.

I have been trying the last few hours and I am completely at a loss as to why this is the case.

This is from trying to run their msgsend.java and msgshow.java demo projects.

I either find an error with the wrong protocol or I cannot connect to the SMTP host: localhost, port 25;

+2


a source to share


3 answers


What do I suggest.

  • Open Eclipse
  • Create a new Java project
  • Create a new Java class that contains the main method (entry point)
  • Create a "libs" folder inside which you will place your jarMail jar and other external dependencies.
  • Right click (from eclipse) on the added jarMail jar file and select Build Path and add the build path.
  • You should now be fine in terms of dependencies and you can start coding your test logic in your main method or other classes that you create.
  • After coding, run the project by right-clicking the class that represents the entry point of the application and select "Run and Run as Java Application"


(This is all I can provide given the details in your question;))

+5


a source


If you are using the examples and using "localhost: 25" as your server, you need the SMTP server to run on the same computer.



If you do not have a local SMTP server, try replacing "localhost" with the SMTP server hostname provided by your ISP.

0


a source


If you get an exception that states that it cannot fix the SMTP host (might be helpful if you posted the exact error), which means Javamail is correctly set in your classpath, but it cannot find the given SMTP host ...

Be aware that simply removing Javamail in Eclipse will not automatically cause the SMTP server to run on your local host (aka your own computer).

So, set up an SMTP server on your computer, or just use your ISP server for testing.

I would suggest later, but if you are interested in the former you can check: http://www.ericdaugherty.com/java/mailserver/

It includes an Eclipse plugin.

0


a source







All Articles