I try to insert multiple attachments into an email,
but I get this error message at 'emailSpecs.attachments = plugins.mail.createBinaryAttachment(name, att)': * *org.mozilla.javascript.JavaScriptException: java.lang.NoClassDefFoundError: com/servoy/j2db/util/ImageLoader* * This is my loop: ```
//get all attachments
var emailSpecs = new Object()
emailSpecs.attachments = new Array()
for ( var i = 1 ; i <= mrk_selected_template_to_email_template_attachment.getSize() ; i++ ){
var record = mrk_selected_template_to_email_template_attachment.getRecord(i)
var name = record.name
var att = record.email_template_attachment
emailSpecs.attachments[i] = plugins.mail.createBinaryAttachment(name, att)
}* ``` Who can help me out?
hmm. All I can do for you is to send you a release candidate of our MailPro-Plugin that will very soon be released (was Imap-Plugin before) and you can see what happens there. The plugin does Imap, POP3 and SMTP in almost all possible ways.
btw: it’s not the images.jar but the jsdb that is needed for the imageLoader. So the plugin should not be needed…
My system uses a seperate table <<media_doc>> for storing all attachments and this enables Users to send multiple attachments with an email. Would this solve your problem ?
var attach = new Array()
var AttachSize = id_documents_to_media_doc_id.getSize()
if ( id_documents_to_media_doc_id.getSize() != 0 )
{
for ( var i2 = 0 ; i2 < AttachSize; i2++)
{
var record = id_documents_to_media_doc_id.getRecord(i2+1)
attach[i2] = plugins.mail.createBinaryAttachment(record.me_filename, record.me_blob) //application.readFile(blob_filepath)
}
grahamg:
Hi Karel
My system uses a seperate table <<media_doc>> for storing all attachments and this enables Users to send multiple attachments with an email. Would this solve your problem ?
Hi Graham,
Thanks for thinking along here!
I do believe we’re doing the same thing here
If you look closely, your method is not really different from what I have.
Still get the Imageloader error
Sorry - got interupted as I was posting and lost the plot a bit - so didn’t explain very well
However, have just tested on this system - which is remotely hosted - and sent an email to myself with four attachments (.xls, .pdf, .tiff & .jpg) and all worked fine. Maybe it’s because I wouldn’t recognise a jsdb ImageLoader if it fell on my foot
This application is on similar setup to you: Servoy 225, Java 1.5, OSX 10.4 & MySQL 5. Are there particluar file type that you are trying/failing to send ?
You need to update your plugins. The ImageLoader class is contained in your j2db.jar file, but was moved from com.servoy.j2db.ImageLoader to com.servoy.j2db.util.ImageLoader. The plugins were updated to reflect this change, so if you download the newest version of the plugins it should work fine.
Note that this is always the case: if you update your Servoy libs you need to make sure you plugins keep in sync!
sebster:
You need to update your plugins. The ImageLoader class is contained in your j2db.jar file, but was moved from com.servoy.j2db.ImageLoader to com.servoy.j2db.util.ImageLoader. The plugins were updated to reflect this change, so if you download the newest version of the plugins it should work fine.
Note that this is always the case: if you update your Servoy libs you need to make sure you plugins keep in sync!
Thanks for the tip, Sebastiaan! But now I need to know which plugs I need to update and where to download them from?
Or could I just replace the 2.2.5 plugs with the 3.0 plugs?
Just install the latest version of Servoy 2 or 3 depending on what you’re using and use those plugins (i.e., replace the ones you’re using now with the new versions).
You can’t use the 3 plugins for 2.2.5. You need the 2.2.5 plugins from the installer you installed Servoy with; or else upgrade to the latest 2.2.x.
The best solution is probably just to get the latest 2.2.x build and use the clean install. If you copy your database files and your servoy.properties to the clean install you should be good to go.