Need help with method to save & view email attachments

Using plugins.mail.receiveMail but just cannot work out how to handle attachments. Using the sample method:

var attachments = msg.getAttachments()
if (attachments != null)
{
for (var j = 0 ; j < attachments.length ; j++)
{
var attachment = attachments[j]
application.output(attachment.getName())
var attachmentDataByteArray = attachment.getData()
//write attachmentDataByteArray to a file…
}
}

But cannot find the attachment files after they’ve been downloaded and (even if I could find them) do not know how to provide the user with a means of opening the attachment.

Could any of the gurus point me in the right direction.

Thanks

Graham Greensall
Worxinfo Ltd

Servoy Developer
Version R2 2.2-build 328
Java version 1.4.2_08-b03 (Windows XP)

Just some guru-talk :wink:

var attachments = msg.getAttachments()
if (attachments != null) 
{
	e_attachmentcount = attachments.length
	for (var j = 0 ; j < attachments.length ; j++)
	{
		forms.email_attachments.controller.newRecord()
		var attachment = attachments[j]
		forms.email_attachments.mail_itemsid = mail_itemsid
		forms.email_attachments.filename = attachment.getName()
		forms.email_attachments.attachment = attachment.getData() //put in blob
		forms.email_attachments.filesize = 	forms.email_attachments.attachment.length
	}
}

Sooo simple when you know how :)

I look forward to presenting some burnt offerings to the Guru Harjo Temple at Servoy World - or you can have a beer if you prefer.

Many thanks

Graham Greensall
Worxinfo Ltd