0

I've been developing a firefox extension, which needs to send an email through the user's email client when a button is pressed.

I've been sending email by simply using a mailto like this:

function sendEmail(buttonEvent){    
    gBrowser.addTab("mailto:example@example.com?subject=Hello World");
}

But I need to add an attachment to the email that is being sent.

I understand that a mailto link can have an attachment under some versions of Outlook, by using an "?attachment" like this: mailto:example@example.com?attachment=""C:\example.txt"", but I've heard that's not cross platform, has been removed from the newest versions of Outlook, so this isn't a real option.

With that in mind, is there anyway to send an email with an attachment in a Firefox extension, without using server side code?

3.3volts
  • 178
  • 1
  • 6

1 Answers1

0

I'm pretty certain that Firefox doesn't have this ability out of the box. This answer shows how one would do it in Delphi - apparently, using OLE is required if an attachment needs to be specified. What you could do is writing your own DLL that would implement this approach, distribute that DLL with your extension and call it via js-ctypes.

You won't get a cross-platform solution this way however, you would need to write similar native libraries for Mac OS X and Linux. And then you have the problem that the user's "mail client" doesn't have to be an application, it could be a web application - and then you definitely cannot attach files to a draft message.

Community
  • 1
  • 1
Wladimir Palant
  • 56,865
  • 12
  • 98
  • 126
  • Alright, thanks for the answer (and for Adblock). It sounds like there isn't a ready way to add attachments; writing native libraries for every platform would be more work than my entire plugin, and this was a non-priority request. – 3.3volts Mar 14 '12 at 14:40