Le lundi 21 octobre 2013 18:29:33 UTC+2, Julien Wajsberg a écrit :
> Le 21/10/2013 18:18, Frédéric Blanchet a écrit :
> 
> 
> 
> Hey !
> 
> 
> 
> as I understand it :
> 
> 
> 
> > 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),
> 
> 
> 
> attachmentNames: [ array of names ],
> 
> attachmentBlobs: [ array of blobs]
> 
> 
> 
> >             }
> 
> > });
> 
> >
> 
> 
> 
> And the blobs should be real blobs. I think you don't need to create
> 
> files, juste create blobs using the Blob constructor. See
> 
> https://developer.mozilla.org/en-US/docs/Web/API/Blob#Blob_constructor_example_usage
> 
> for some examples.
> 
> 
> 
> -- 
> 
> Julien
Hello all,

   Thanks for your help, Julien 

   I tried this code (by using Blob API), but the composer appears without the 
attachment. It is the correct way to use it ? It is possible with firefox 
simulator to track the call of the composer to identify the requested 
parameters for the activity ? 
 

var aHTMLPart = ['<html>some html data</html>'];
var oHTMLBlob = new Blob(aHTMLPart, {type : 'text/html'}); // the blob


var createEmail = new MozActivity({
        name: "new", 
        data: {
                type : "mail",
                url: "mailto:"+Configuration.getInstance().playerEmail +
                        "?subject=" + 
encodeURIComponent(jQuery.i18n.prop('msg_score')+" " + myScore.nameGolf+ " " 
+myScore.date) + 
                        "&body=" + encodeURIComponent(myTxtMail),
                attachmentNames: ["file1.html"],
                attachmentBlobs: [oHTMLBlob]
        }
});

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

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


Thanks in advance for any help. 

Regards, 
Frédéric 


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

Reply via email to