Hello

   I’m porting one personal golf application from Android (HTML with phonegap) 
to firefoxOS 1.1. The goal is to note your score card during golf courses and 
send the result by email at the end of the courses.  The current device is the 
Developer Preview Keon.

    For this firefoxOS application, I’m trying to send an email by using the 
MozActivity. All is ok for a simple text mail, but I need to add attachment in 
the mail. With the deviceStroage API, like navigator.getDeviceStorage I created 
in the the SDCARD two files (named GolfScoreCard.html and GolfScoreCard.kml), 
that I need to attach to the email.  
 

Looking the mail_app.js files on github ( 
https://github.com/mozilla-b2g/gaia/blob/master/apps/email/js/mail_app.js ),it 
seems possible (an attachmentBlobs arrays exists)

line 321 :
if (attachmentBlobs) {
            for (var iBlob = 0; iBlob < attachmentBlobs.length; iBlob++) {
              composer.addAttachment({
                name: data.attachmentNames[iBlob],
                blob: attachmentBlobs[iBlob]
              });
            }...

But I still don’t found the way to attach the file in the API. My code today to 
create the mail be requesting the mailComponser is:

var myTxtMail="The body for the email";
var createEmail = new MozActivity({
             name: "new",
             data: {
                    type: "mail",
                    url: "mailto:"; + Configuration.getInstance().playerEmail +
                    "?subject=THE_subject&body=" + encodeURIComponent(myTxtMail)
                }
});

createEmail.onsuccess = function () {
        console.log("EMAIL SENT");
}

createEmail.onerror = function () {
        // If an error occurred or the user canceled the activity
        console.log("NO MAIL");
};

And my goal is to attach two files in the mail. It is possible? I didn’t found 
the information on this link: 
https://developer.mozilla.org/fr/docs/WebAPI/Web_Activities

Thanks in advances for any help, If more information are needed, I will provide 
it.

Regards,
Frederic
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to