("->fileAttachment DISTINTO de NULL") įileDataSource fds = new FileDataSource(fileAttachment) Multipart multipart = new MimeMultipart("alternative") Multipart multipart = new MimeMultipart() MimeBodyPart messageBodyPart = new MimeBodyPart() If ( fileAttachment != null & fileAttachment != "NO" ) InternetAddress address = InternetAddress.parse(to, false) MimeMessage message = new MimeMessage(session) Session = Session.getDefaultInstance(props, null) Session = Session.getDefaultInstance(props,auth) MyPasswordAuthenticator auth = new MyPasswordAuthenticator(username, password) #EXPRESS ZIP FILE EMAIL ATTACHMENTS ARCHIVE#This creates a zip archive I can properly inspect/unzip via zipinfo / unzip. You may receive the worm as an attachment called zippedfiles.exe, masquerading itself as the usual self-extracting zip file. create some properties and get the default Session 1 Answer Sorted by: 11 You need to pass your options to zip.generate not zip.file. If I specify an attachment, then a myme multipart doby is created: one for text and the other for the attachemnt I use this myme ovbject only for attachemnts, because some ISPs have problems and report error in email format if the attachemnet is missing and it contains only text and no attachment. Loop through any erroneous attachmentsįor (int i=0 i < fileErrors.length i++)Ĭheck the first "if". tDataHandler(new DataHandler(fds)) įor (int i = 0 i < checkedFiles.length i++ ) Set the data handler to the attachment * otherwise attach all the checked files */įile zipped = new File(MyZip.ZipUpFiles(checkedFiles)) * If zipped requested, send all checked files to be zipped The resulting zipped file is then attached. If anyone can see anything obvious, I'd appreciate a few pointers. I've tried files that have been winzipped added them as attachments using javamail and I get the same error, so it seems the problem is definitely where I attach the zipped file. Suppose you have a doc file of approx 12MB (Megabytes) and you want to send it to your friend through e. If I then attach that zip file to an email using javamail, I get an "does not appear to be a vaild archive error:" from winzip. I've written a utility to zip files up, and the resulting archive is recognised as a zip file by winzip. I'm having problems sending zip files as attachments. 1.7K Training / Learning / Certification.165.3K Java EE (Java Enterprise Edition).7.9K Oracle Database Express Edition (XE).3.8K Java and JavaScript in the Database.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |