my dog learned polymorphism
The moose likes Other JSE/JEE APIs 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 » Other JSE/JEE APIs
Bookmark "Java Mail" Watch "Java Mail" New topic

Java Mail

Arathi Raj
Ranch Hand

Joined: Nov 22, 2002
Posts: 90
I downloaded Java mail API and JAF. I tried to run the program which is included in Java mail api called msgsend. I have used net beans to compile the program. It is compiling well. but when i execute the program it ask me to enter to address and subject. In javamail api they have mentioned to end the program by using ctrl-z. but that is not working and even it is not printing that your message has been sent. Can any one tell me how to do. The link is here regarding tutorial
Megha Roy

Joined: Sep 12, 2003
Posts: 13
Somebody please help with this
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
Which mail server do you use? First of all, make sure your mail server is up and running, and then
1. Put mail.jar and activation.jar explicitly in your classpath
2. then compiled the program C:\javamail-1.3.1\demo\>javac
3. then tried running the program with
C:\javamail-1.3.1\demo>java msgsend -o from@domainName -M
NameOfYOurServer to@domainName
for example:
C:\javamail-1.3.1\demo>java msgsend -o -M
4. The console asks for the subject.
5. fill something in the Subject and followed by <enter>
6. write a message and followed by <enter>
7. ctrl Z to indicate end of message and followed by <enter>
8. "Mail was send successfully" should be prompted to the console
BTW, when testing with msgsend you can use msgshow afterwards to see if your message arrived, like this 'java msgshow -L pop3://userid assword@localhost'. (make sure that you compile first)
I agree. Here's the link:
subject: Java Mail
It's not a secret anymore!