Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Save Attachment and send it

25 views
Skip to first unread message

Christopher K.

unread,
May 14, 2009, 9:49:56 AM5/14/09
to
Hi,

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.

Andrew Sutherland

unread,
May 14, 2009, 10:11:14 AM5/14/09
to
On 05/14/2009 06:49 AM, Christopher K. wrote:
> Now i don't know how to proceed. I need to save the attachment somehow
> to send it afterwards to this webserver.

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:

http://lookout.mozdev.org/

particuarly the save_attachment method in lookout.js:

http://www.mozdev.org/source/browse/lookout/src/chrome/content/lookout.js?rev=HEAD

Andrew

0 new messages