Hi JB, impressive memory.. found the ticket: https://issues.apache.org/jira/browse/KARAF-5571 unresolved, but I encountered the same exception a few hours ago. I think that the "no object dch for mime type" is a result of the class loader separation... but i have no idea from which class I should replace my context class loader before sending the mail.
Am Mo., 27. Jan. 2020 um 21:22 Uhr schrieb Jean-Baptiste Onofré < j...@nanthrax.net>: > Hi Matthias, > > AFAIR, we have a Jira about that. Are you sure about the activation > version you are using ? > > Regards > JB > > On 27/01/2020 21:16, Matthias Leinweber wrote: > > > > Hello Karaf Users, > > > > Hello Karaf-Team, > > > > I try to create a Component which is able to send mails. I looked into > > the decanter email component and basically used it and modified it for > > multi part. > > The strange this is, that somehow the client can't read a response. I > > have no idea what i could do... i read something about class loader > > problems with this error. But i cant get it working. > > Using karaf 4.2.8 with java9 > > I added com.sun.activation/javax.activation/1.2.0 for > > javax.activation.DataHandler (missing/hidden/removed in jdk9?) > > > > Here is the debug log from the Session: > > > > DEBUG: setDebug: JavaMail version 1.6.0 > > DEBUG: getProvider() returning > > > javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle,1.6.0] > > DEBUG SMTP: useEhlo true, useAuth false > > DEBUG SMTP: trying to connect to host "172.18.0.1", port 25000, isSSL > false > > 220 this-is-correct.xx ESMTP Postfix > > DEBUG SMTP: connected to host "172.18.0.1", port: 25000 > > > > EHLO c7182e3f0afe > > 250-this-is-correct.xx > > 250-PIPELINING > > 250-SIZE 30720000 > > 250-VRFY > > 250-ETRN > > 250-ENHANCEDSTATUSCODES > > 250-8BITMIME > > 250 DSN > > DEBUG SMTP: Found extension "PIPELINING", arg "" > > DEBUG SMTP: Found extension "SIZE", arg "30720000" > > DEBUG SMTP: Found extension "VRFY", arg "" > > DEBUG SMTP: Found extension "ETRN", arg "" > > DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg "" > > DEBUG SMTP: Found extension "8BITMIME", arg "" > > DEBUG SMTP: Found extension "DSN", arg "" > > DEBUG SMTP: use8bit false > > MAIL FROM:<also-cor...@somewhere.xx> > > 250 2.1.0 Ok > > RCPT TO:<my.corrent@mail.address> > > 250 2.1.5 Ok > > DEBUG SMTP: Verified Addresses > > DEBUG SMTP: my.corrent@mail.address > > DATA > > 354 End data with <CR><LF>.<CR><LF> > > DEBUG SMTP: IOException while sending, closing, THROW: > > javax.activation.UnsupportedDataTypeException: no object DCH for MIME > > type multipart/mixed; > > boundary="----=_Part_0_973667738.1580155842011" > > .... > > > > And here is basically my code: > > properties = new Properties(); > > properties.put("mail.smtp.host", cc.getString("hostname")); > > properties.put("mail.smtp.port", cc.getString("port")); > > properties.put("mail.smtp.connectiontimeout", "10000"); > > properties.put("mail.smtp.timeout", "10000"); > > [....] > > > > Session session = Session.getInstance(properties); > > session.setDebug(true); > > MimeMessage message = new MimeMessage(session); > > Multipart multipart = new MimeMultipart(); > > message.setFrom(new InternetAddress(from)); > > message.setSubject(subject); > > for (String to : tos) { > > message.addRecipients(Message.RecipientType.TO > > <http://Message.RecipientType.TO>, to); > > } > > > > BodyPart messageBodyPart = new MimeBodyPart(); > > messageBodyPart.setText("This is message body"); > > multipart.addBodyPart(messageBodyPart); > > > > byte[] bytes = bos.toByteArray(); //very small > > MimeBodyPart mimeBodyPart = new MimeBodyPart(); > > ByteArrayDataSource ds = new ByteArrayDataSource(bytes, > > "application/octet-stream"); > > mimeBodyPart.setDataHandler(new DataHandler(ds)); > > mimeBodyPart.setFileName(UUID.randomUUID().toString()); > > multipart.addBodyPart(mimeBodyPart); > > > > message.setContent(multipart); > > Transport.send(message); > > > > best regards, > > it is not > > -- > Jean-Baptiste Onofré > jbono...@apache.org > http://blog.nanthrax.net > Talend - http://www.talend.com > -- Matthias Leinweber - Data Tactics Telefon: +49 176 810 24580 E-Mail: m.leinwe...@datatactics.de Internet: http://www.datatactics.de Postanschrift: Grabenheckerstraße 9, 35232 Dautphetal