# Inserting multiple attachments

**URL:** <https://forum.servoy.com/t/inserting-multiple-attachments/6651>\
**Category:** Classic Servoy\
**Created:** [October 27, 2006, 10:54am UTC](https://forum.servoy.com/t/inserting-multiple-attachments/6651 "2006-10-27T10:54:36Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karel\_Broer](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@Karel\_Broer](https://forum.servoy.com/u/Karel_Broer)\
**Post date:** [October 27, 2006, 10:54am UTC](https://forum.servoy.com/t/inserting-multiple-attachments/6651/1 "2006-10-27T10:54:36Z")

</div>

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()

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [October 27, 2006, 11:15am UTC](https://forum.servoy.com/t/inserting-multiple-attachments/6651/2 "2006-10-27T11:15:31Z")

</div>

The Servoy mail plugin needs the ImageLoader to figure out the mime type of the attachment. Do you have an images.jar in your plugins folder?

---

<div class="post-metadata">

**Author:** ![Karel\_Broer](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@Karel\_Broer](https://forum.servoy.com/u/Karel_Broer)\
**Post date:** [October 27, 2006, 11:19am UTC](https://forum.servoy.com/t/inserting-multiple-attachments/6651/3 "2006-10-27T11:19:37Z")

</div>

> patrick:  
> The Servoy mail plugin needs the ImageLoader to figure out the mime type of the attachment.

OK… thanks Patrick!

> Do you have an images.jar in your plugins folder?

Yes, I have. These are my Developer specs:

Version R2 2.2.5-build 337  
Java version 1.5.0\_06-64 (Mac OS X)

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [October 27, 2006, 11:45am UTC](https://forum.servoy.com/t/inserting-multiple-attachments/6651/4 "2006-10-27T11:45:11Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![grahamg](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@grahamg](https://forum.servoy.com/u/grahamg)\
**Post date:** [October 27, 2006, 12:26pm UTC](https://forum.servoy.com/t/inserting-multiple-attachments/6651/5 "2006-10-27T12:26:13Z")

</div>

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 ?

> 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](https://application.readFile)(blob\_filepath)  
> }
> 
> }  
> var success = plugins.mail.sendMail(em\_To, em\_From, em\_Subj, em\_Detl, em\_CC, em\_BCC, attach, EmailAuth );

Regards

Graham Greensall  
Worxinfo Ltd

---

<div class="post-metadata">

**Author:** ![Karel\_Broer](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@Karel\_Broer](https://forum.servoy.com/u/Karel_Broer)\
**Post date:** [October 27, 2006, 1:15pm UTC](https://forum.servoy.com/t/inserting-multiple-attachments/6651/6 "2006-10-27T13:15:23Z")

</div>

> 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 ![:wink:]( "Wink")  
If you look closely, your method is not really different from what I have.  
Still get the Imageloader error ![:(]( "Sad")

---

<div class="post-metadata">

**Author:** ![Karel\_Broer](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@Karel\_Broer](https://forum.servoy.com/u/Karel_Broer)\
**Post date:** [October 27, 2006, 1:24pm UTC](https://forum.servoy.com/t/inserting-multiple-attachments/6651/7 "2006-10-27T13:24:49Z")

</div>

> patrick:  
> it’s not the images.jar but the jsdb that is needed for the imageLoader. So the plugin should not be needed…

I agree… must be something with the blob then… I use MySQL 5. Could that be the problem?

---

<div class="post-metadata">

**Author:** ![grahamg](https://avatars.discourse-cdn.com/v4/letter/g/a4c791/32.png) [@grahamg](https://forum.servoy.com/u/grahamg)\
**Post date:** [October 27, 2006, 1:38pm UTC](https://forum.servoy.com/t/inserting-multiple-attachments/6651/8 "2006-10-27T13:38:47Z")

</div>

Hi Karel

Sorry - got interupted as I was posting and lost the plot a bit - so didn’t explain very well ![:?]( "Confused")

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 ![:)]( "Smile")

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 ?

Regards

Graham

---

<div class="post-metadata">

**Author:** ![sebster](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@sebster](https://forum.servoy.com/u/sebster)\
**Post date:** [October 27, 2006, 2:25pm UTC](https://forum.servoy.com/t/inserting-multiple-attachments/6651/9 "2006-10-27T14:25:23Z")

</div>

Hi,

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!

---

<div class="post-metadata">

**Author:** ![Karel\_Broer](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@Karel\_Broer](https://forum.servoy.com/u/Karel_Broer)\
**Post date:** [October 27, 2006, 5:45pm UTC](https://forum.servoy.com/t/inserting-multiple-attachments/6651/10 "2006-10-27T17:45:56Z")

</div>

> 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?

---

<div class="post-metadata">

**Author:** ![sebster](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@sebster](https://forum.servoy.com/u/sebster)\
**Post date:** [October 27, 2006, 6:40pm UTC](https://forum.servoy.com/t/inserting-multiple-attachments/6651/11 "2006-10-27T18:40:31Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![Karel\_Broer](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@Karel\_Broer](https://forum.servoy.com/u/Karel_Broer)\
**Post date:** [October 27, 2006, 7:19pm UTC](https://forum.servoy.com/t/inserting-multiple-attachments/6651/12 "2006-10-27T19:19:08Z")

</div>

Replaced the whole plugs folder in 2.2.5 for the 3 plugs folder, but didn’t solve the issue… ![:cry:]( "Crying or Very sad")  
Do I need to do more, Sebastiaan?

---

<div class="post-metadata">

**Author:** ![sebster](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@sebster](https://forum.servoy.com/u/sebster)\
**Post date:** [October 27, 2006, 7:43pm UTC](https://forum.servoy.com/t/inserting-multiple-attachments/6651/13 "2006-10-27T19:43:00Z")

</div>

What version of Servoy are you using?

---

<div class="post-metadata">

**Author:** ![Karel\_Broer](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@Karel\_Broer](https://forum.servoy.com/u/Karel_Broer)\
**Post date:** [October 27, 2006, 7:47pm UTC](https://forum.servoy.com/t/inserting-multiple-attachments/6651/14 "2006-10-27T19:47:33Z")

</div>

Servoy Developer  
Version R2 2.2.5-build 337  
Java version 1.5.0\_06-64 (Mac OS X)

Can’t go to Servoy 3 for this yet, because there are still clients using 2.2.5…

---

<div class="post-metadata">

**Author:** ![sebster](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@sebster](https://forum.servoy.com/u/sebster)\
**Post date:** [October 27, 2006, 7:58pm UTC](https://forum.servoy.com/t/inserting-multiple-attachments/6651/15 "2006-10-27T19:58:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Karel\_Broer](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@Karel\_Broer](https://forum.servoy.com/u/Karel_Broer)\
**Post date:** [October 27, 2006, 9:27pm UTC](https://forum.servoy.com/t/inserting-multiple-attachments/6651/16 "2006-10-27T21:27:59Z")

</div>

> sebster:  
> The best solution is probably just to get the latest 2.2.x build and use the clean install.

YES!!! That solved it. Many thanks Sebster! ![:D]( "Very Happy")
