i am developing for my company an extension, which should get the
mailcontent, subject and attachments and send it to an Webserver.
I managed to get the mail-subject and body (maybe not the optimal way,
but that doesn't matter for now). I also managed to get the attachmentlist.
Now i don't know how to proceed. I need to save the attachment somehow
to send it afterwards to this webserver.
I should notice, I only need to send each attachment in one request.
My question is now: How do I save an attachment (to an temporary
folder)? And how can I send a file to a webserver? I send and receive
data per XMLHttpRequest, but XHR can't send files.
Greetings,
Christopher K.
You don't actually need to save the attachment to disk; you can access a
stream of it.
I would suggest taking a look at the source code for the LookOut extension:
particuarly the save_attachment method in lookout.js:
http://www.mozdev.org/source/browse/lookout/src/chrome/content/lookout.js?rev=HEAD
Andrew