We have an existing Java web application that occasionally needs to send users an email with an image attachment. Right now, the J2EE web app is running on Tomcat in Windows, and we just have it exec() a process that runs the tiny little Blat program, like this:
Code:
try {
Process blatProcess = java.lang.Runtime.getRuntime().exec(new String[] {
"C:\\blat222\\full\\blat.exe", "-", "-server", smtpHost,
"-f", copyAddress, "-from", "Mailer@noreply.com",
"-subject", "ID #" + idNumber,
"-to", this.getRecipientAddress(),
"-bcc", bccAddress,
"-replyto", this.getSenderAddress(), "-attach", attachmentAbsolutePath,
"-body", messageText});
}
catch (IOException e) {
System.out.println("Problem with running Blat: " + e);
}
As you can see, all I need to be able to do is send a little email with an image attachment. I don't even care if I can't BCC our log email address anymore. What would be the quickest/simplest/easiest solution to get the same functionality when we move this web app to Tomcat on Linux? From what I've read, sendmail might be a bigger deal than what I'm looking for. I don't think there's any way for me to attach to the email in pure Java without getting into the JavaMail API.
Thanks...