i meet a very weird thing this morning, I use mail plugin to send the email on servoy version 7.4.1.
The sending email function works beautifully on developer.
On the sever, if I send an only html contnet email, it works good.
But if i try to send an email with some attachments, no matter the attachment is embedded or not, the application will log an exception:
- Code: Select all
javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
It is so strange, here is the sample code i used for testing.
- Code: Select all
function onActionSendEmailTest(event) {
var attachments = new Array();
var att1 = plugins.file.convertToJSFile('c:\\mailmsg.txt');
attachments.push(plugins.mail.createBinaryAttachment('mailmsg.txt', att1.getBytes(), att1.getContentType()));
var att2 = plugins.file.convertToJSFile('c:\\1.jpg');
attachments.push(plugins.mail.createBinaryAttachment('1.jpg', att2.getBytes(), att2.getContentType()));
var success = plugins.mail.sendMail('to@emailaddress.com', 'from@emailaddress.com', '1111', '<html><body><p>111</p><img src="%%1.jpg%%"></body></html>', null, null, attachments, ["mail.smtp.host=192.168.0.100","mail.smtp.port=25","mail.smtp.auth=false","mail.smtp.username=","mail.smtp.password=","mail.smtp.starttls.enable=false"]);
if (!success) {
application.output('------------------------------------------>error: '+plugins.mail.getLastSendMailExceptionMsg());
} else {
application.output('------------------------------------------>success');
}
}
Is there anything wrong with my code? Does anyone meet the same problem before?
I really need your help.
BTW, is there any way I can debug the mail plugin? I just want to see the mail message the plugin built, I suspect the problem happened when building the message.
Thank you very much, guys.