How do you make PalmService email platform-independent?

I have the following code in my TouchPad Enyo 1.0 app:
{
name: "emailService",
kind: "PalmService",
service: "palm://com.palm.applicationManager",
method: "launch",
onSuccess: "emailServiceSuccess",
onFailure: "emailServiceFailure"
}
Is there a way to make this platform-independent, or, at least, Windows Desktop-compatible?

............Phil

Comments

  • What you want to do is launch the email system here... each platform has different ways to do this. On Windows, your best bet would be to try to navigate to a mailto: format URL and let the WebKit engine dispatch that to the system's mail client.
  • @unwiredben,

    Thanks for the idea. However, I've now tried using the following, but I'm not seeing a connection to my email client:
    this.$.webView.setUrl("mailto:[email protected]?subject=" +
    escape(email_subject) +
    "&body=" +
    escape(email_text));
    Is this a problem with webView, or have I done something wrong myself? I read in one of the forums that Enyo can't process "mailto:" in webView. Is that true?

    .........Phil
  • The webview kind uses the webOS browser engine and thus is not platform independent. I'd try something like window.open('mailto:[email protected]')
  • edited January 2012
    Might try the old school window.open()

    Edit: See above from @MaKleSoft :)
  • window.open('mailto:[email protected]')

    Will work for Android and Chrome. In iOS, I like to use the EmailComposer plugin: https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/EmailComposer
  • I eventually settled on window.open(), but have sometimes also had used escape() or replace() to format the resulting email, as .innerHTML provides too much formatting, and .innerText too little.

    Thanks for all the suggestions.........Phil
  • I'm generating more questions as I get into this development project!

    In my HTML5 + Javascript app I'm generating a mailto: string for window.open to create an email.
    var email_text = "I have a new question for this ebook." + " I have included my question here:\n ----------\n\n\n\n\n\n ----------\n";
    var email_subject = this.ebook_title + " (new question)";
    window.open("mailto:[email protected]?subject=" +
    escape(email_subject) +
    "&body=" +
    escape(email_text));
    In Chrome I get the following (which is what I'd like to see!):
    I have a new question for this ebook. I have included my question here:
    ----------





    ----------
    In the encapsulated Windows app I get the following:
    I have a new question for this ebook. I have included my question here: ---------- ----------
    What do I need to put into the mailto: string to produce new lines? I'm using my Thunderbird email client in both cases, so the problem appears to lie in the encapsulation wrapper.

    I've also tried using \r\n, %0D%0A and %0A, but none of these create emails that look the way I want them too.

    ............Phil
  • edited February 2012
    Have you tried <br />?
  • I've tried, and it is no better :-(
    I have a new question about SAS code for this ebook. I have included my question here:<br /> ----------<br /><br /> ----------
    I'm now thinking that Intel AppUp is not the way to go, so I'm trying the Chrome Web Store instead, as I already know this apps works fine in Chrome.

    .........Phil
  • edited February 2012
    I tried the mailto trick with ICS.

    body does not work (is empty) when using the standard email app.

    body works when using GMail, but special characters are broken and it does not do HTML (like on webOS).

    I will try to use the WebIntent plugin next...
  • window.open('mailto link') seems to work in iOS, but not in anything else that i've tried it on.
  • Yeah, I suspect this depends a lot on the email app that's getting launched with the mailto: link and what it supports. If you really need control, you'll need to use a web-to-mail service through your site.
  • WebIntent plugin works great on Android!
  • How to use WebIntent to send an HTML email (it does however not support as many HTML tags as the webOS email app):
            var extras = {};
            extras[WebIntent.EXTRA_SUBJECT] = "Test";
            extras[WebIntent.EXTRA_TEXT] = body;
            window.plugins.webintent.startActivity({ 
                action: WebIntent.ACTION_SEND,
                type: 'text/html', 
                extras: extras 
              }, 
              function() {}, 
              function() {
                alert('Failed to send email via Android Intent');
              }
            );
    
Sign In or Register to comment.