Hi i want to know that is there any activity from where i can fill the email activity and start it from my program.. like this...

- 6,620
- 12
- 48
- 49

- 440
- 4
- 25
-
1Have you tried using the new activity? There is an example of it here: https://github.com/robnyman/Firefox-OS-Boilerplate-App/blob/gh-pages/js/webapp.js try adding `body` it should work – Aras Sep 16 '13 at 19:26
-
Thanx for this link... do you know how to attach file and fil the body as well? – Areeb Gillani Sep 18 '13 at 09:00
2 Answers
To populate a subject, cc, bcc and/or body, simply append this information onto the mailto url:
data: {
type : "mail",
url: "mailto:example@example.org?subject=this%20is%20a%20test&cc=example2@example.org",
}
Regarding how to include an attachment, that depends on which version of Firefox OS you want your app to be compatible with.
As of Firefox OS 1.2, you can simply add blobs
and filenames
objects to the data object:
data: {
type : "mail",
url: "mailto:example@example.org?subject=this%20is%20a%20test&cc=example2@example.org",
blobs: [testBlob],
filenames: ['test.html']
}
I've updated the Firefox OS Boilerplate app to include a working example of this. The related bits of Firefox OS code can be found in apps/email/js/app_messages.js and apps/email/js/mail_app.js.
Prior to Firefox 1.2, the new
(mail) activity does not accept these parameters and you'll need to use the share
activity:
var sharingImage = new MozActivity({
name: "share",
data: {
type: "image/*",
number: 1,
blobs: [blob]
}
});
The Firefox OS Boilerplate includes a working example of the share activity.
The relevant code showing that attachments are limited to the share activity in version 1.1 is in apps/email/js/mail-app.js.

- 297
- 1
- 5
From what I could dig, there seems to be two ways to open the compose window of the email app with the fields filled:
1. regular email link
You can pass subject, body, cc, bcc strings as query URL parameters on a mailto link, for example:
<a href="mailto:mail@example.com?subject=foo&body=bar>email link</a>
Using this method you won't be able to fill the attachment.
To fill a file attachment, you would need to use the second way which is…
2. web activity "share"
The share web activity will ask for the user which of the apps that accepts the share activity she would like to chose for sharing the file, this activity is what the Gallery App uses to share pictures, if the email app is chosen, it will fill the compose message window according to the parameters you pass.
If you look at the source code of the email app, you'll see that on Firefox OS 1.1 (v1-train branch) the activity handler for the share activity accepts 2 parameters: data.blobs and data.filenames. Later versions (like Firefox OS 1.2) also support an url parameter that can have the other fields subject, body, cc, bcc as part of the query string.

- 114
- 1
- 5