nedimf / maildroid

Maildroid is a small robust android library for sending emails using SMTP server
188 stars 24 forks source link

MessagingException: IOException while sending message; .... no object DCH for MIME type multipart/mixed; #49

Closed mengbai123 closed 9 months ago

mengbai123 commented 1 year ago

My app is perfectly fine in general, but I need to use apktools to modify and repackage it into some different version, and I get errors on the new app.

Bug occurs in Transport.send() function

Snipaste_2023-05-17_15-15-58 Snipaste_2023-05-17_15-15-51

Here are some bug related pages I found

https://www.e-learn.cn/qa/q-218039.html

I found a solution based on the page above Add such code to Builder class it will allright

open class Builder {

        init {
            (CommandMap.getDefaultCommandMap() as MailcapCommandMap).apply {
                addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html")
                addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml")
                addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain")
                addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed")
                addMailcap("message/rfc822;; x-java-content- handler=com.sun.mail.handlers.message_rfc822")
            }
        }
nedimf commented 1 year ago

Be free to add PR, if you think this could solve it.

KamilK2003 commented 11 months ago

Hi, is there ultimately something I could do to avoid this bug? @mengbai123 @nedimf

Regards, Kamil

nedimf commented 9 months ago

Sorry for a late, answer but it seems that this bug happens only if you are repackaging app.