How do I let player email their high score to friends

0 favourites
  • 15 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • Hi,

    I'm hoping to have the game automatically bring up their default email software and pre-populate the subject and body of the email, with "I just scored so many points in GameX"

    Anyone know if there's any way I can go about this, and if so, how?

    thanks

    Mike

  • No one?

  • Using the browser object open url : "mailto:someone@example.com" , and any of the regular html flags should work there in.

    Note: It will open the email client, and on mobiles that may mean stopping the game completely.

  • Thanks so much newt... I'll give it a shot.

    cheers,

    Mike

  • That worked, thanks!

    My final URL WAS: mailto:?subject=MYGAME score!&body=I just scored ____ points on MYGAME. Can you beat that? http://www.MYGAME.com

    I use the replace text feature to replace the ____ with the actual score before using that text as a URL.

    cheers,

    Mike

  • Update! This wasn't working on IOS devices, so I needed to encode the text for the subject and body AND IOS DEMANDS AN EMAIL ADDRESS!!!, like so:

    mailto:contact@jumpanzi.com?subject=MYGAME%20score!&body=I%20just%20scored%20one%20POINT%20on%20MYGAME.%20Can%20you%20beat%20that%3F%20http%3A%2F%2Fwww.MYGAME.com

    This format seems to work on all platforms

  • Ok, I guess you could let the user add the email via a text box, and add it using "mailto:"&myvariable.myvalue.

    I know you can even add an image, but that doesn't work for all clients.

  • Hi newt,

    This is indeed turning into a ridiculously difficult project.. you'd think something so basic would be universal after all these decades...

    Currently my mailto URL works on the device in chrome, or as an app (cocoonjs) BUT refuses to work now in safari even though it did once, but never again even though I changed nothing...sigh...

    Also, It seems the MUST HAVE EMAIL ADDRESS rule is no longer true, as it worked at least on chrome and as an app with no email.

    I'll report back if I figure out a truly universal solution.

    Can you please explain how to include an image?!? That would be cool... but of course, if it then breaks on many of the platforms its most likely not worth it...I'd still like to give it a shot though.,

  • Wouldn't it be easier to just handle this with an AJax request and a PHP on a webserver to send the email?

  • Wouldn't it be easier to just handle this with an AJax request and a PHP on a webserver to send the email?

    It is, and it works on every device.

  • dsarchy

    I guess easier if one already knows how to use Ajax request, PHP files and webservers. It saddens me that mailto, after all these years isn't universally supported an any remotely cohesive way...seems really lame.

    thanks for pointing me in the right direction for a potentially universal solution.. I'll google the terms you used and invest the time to learn and do those steps, as sadly, what should be a simple solution is not.

    cheers,

    Mike

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Well its not the simplest solution, but it is the most robust, other than possibly using the nodejs portion of node-webkit.

    As to adding images you can try the canvas snapshot, or Rojo's canvas as the base 64 string: "mailto:somebody@something.com?body=<img src="&Canvas.imageUrl&">"

    It worked for me in Ios, and Windows 7.

  • cool newt. thanks I'll try that... I still cant get mailto to work on IOS safari though.... which is very strange...If I enter mailto URL's directly into safari, it will work, when I do it from the game (via web) it fails.

  • You could also go the service route.

    http://mandrill.com/

  • I solved the mailto issue on safari IOS!!!!!!! The trick is to make sure to use browser/go to URL and NOT browser/open in new window specifically for mailto....for opening facebook or twitter pre-populated posts, you want to use browser/open in new window.

    Thanks for all the suggestions everyone.

    -Mike

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)