I have a requirement to send emails with zip attachments. I have to extract the data from the database, zip it and then email it. The problem is that I'm trying to do this without actually writing a zip file on the local system. If I attach it as a zip file I have no problem. I've searched high and low for examples but not found any. Is there any technical limitation that precludes this solution? Any ideas , anyone? I'm using the Java Mail Api for emailing and the java.util.zip package for zipping.
posted 11 years ago
To attach the zip file, you will need to provide the file path (to your physical zip file) to the javamail. If you don't have physical file then how can you even attach it?
but then if you don't want the zip file after emailing, you can always call a method to delete the zip file on your local machine.