I had a class loader issue with emailing from Mendix 5.1.1 in a proof-of-concept. I put the classloader related statements in comment in method mail in EmailModule.java. After that it seemed to work just fine. Then I got another task and I completely forgot about this. So I have no idea why the code attempted to swap classloaders. The code below is the method as I have it now in the project. Maybe someone else can tell what the code is intended for.
public static void mail(SMTPConfiguration configuration, String htmlmsg, String plainmsg, String subject, List<String> to, List<String> cc, List<String> bcc, IContext context, List<IMendixObject> attachments) throws CoreException
{
Message message = new Message();
message.setPlainBody(plainmsg);
message.setHtmlBody(htmlmsg);
Sender sender = new Sender(context);
// Thread currentThread = Thread.currentThread();
// ClassLoader newClassLoader = Transport.class.getClassLoader();
// ClassLoader oldClassLoader = currentThread.getContextClassLoader();
try {
// currentThread.setContextClassLoader(newClassLoader);
sender.send(configuration, message, subject, to, cc, bcc, attachments);
} catch (EmailException e) {
throw new CoreException("Unable to send email.", e);
}
finally
{
// currentThread.setContextClassLoader(oldClassLoader);
}
}
This indeed has something to do with classloaders and should already be solved in the latest versions of the email module.
After upgrading to 5.6.0 the e-mail function crashes:
no object DCH for MIME type multipart/mixed; boundary="----=Part9_1848052074.1404549300729"
com.mendix.core.CoreRuntimeException: com.mendix.core.CoreException: Unable to send email. at com.mendix.core.component.InternalCore.execute(SourceFile:271)
I have no idea why this now shows up, it worked before....
Any chance that your DCH object is empty or has no content?