Thanks! I am working with Java SE, but the links are broken for the downloads it suggests if you are working with SE. Any chance you could point me to the correct current download links for JavaMail, and JavaBeans Activation Framework?
Yup, JavaMail is your friend in this case. And your google keyword, too. Since Oracle took over from Sun they have massively changed the download sites and most old links will be broken. So just google it and you should find the download before long.
Also if you're using Java 6 or later then you don't need to download the Activation Framework any more, since it's built into the standard API now.
The other thing you're going to need, besides software, is access to an SMTP server. If you don't have that then there isn't any point in writing e-mail-sending code.
got it working. For anyone stumbiling on this thread here is the class and config file I used to sent through gmail. I hard coded the password in the class. Obviouslyi this is probably really bad form. But for a newb just trying to make a script to send a warning email, it gets the job done. I just used a "junk" gmail account that is not really used for anything.
Ben David wrote:I tried putting the mail.jar in the folder with the class files incase it needed that to run.
Clearly it does need that jar, since it's looking for one of the classes in it. But it looks in the classpath. You already knew about the classpath, I see from one of your earlier posts; set it up correctly so that mail.jar is in the classpath.
Sorry if I ask newb questions... I am aware of classpath. I was under the impression that the current directory was always part of the class path. (how else does java find the other two of my own class files in the same folder when I run Java on the one with the static Main method) So when I put the jar in the current folder I thought I was putting it in the classpath.
Is that not correct? The current directory is not always in the class path? and if not, just so I can have a clearer understanding, can someone explain how Java finds my other two class files in the current folder, but fails to find the jar?
Ben David wrote:I was under the impression that the current directory was always part of the class path.
No, that's wrong. The current directory IS the classpath if you don't specify one, otherwise the classpath is what you say it is.
And it's also irrelevant: the class which caused the problem wasn't in your current directory anyway. It was in a jar file.
So you may be "aware" of the classpath but the JVM doesn't care about that. It only cares about what you actually set the classpath to be. So you should spend a few minutes learning how to set your classpath properly.
Yes, I thought that sounded strange too. But that FAQ is an excellent document and it's worth reading if you're working with e-mail. Anyway it sounds like you did something which fixed the problem, so that's good.