Hi,
This is a modified version of Application Open Url, so that it will only generate a mailto link, with the option to add a Subject and Body text.
It will get rid of the formatting problems that sometimes happen when adding text to fields in Application.OpenURL
I tested only on iOS and the editor, but it should work in any platform where Application.OpenURL is supported.
// (c) Copyright HutongGames, LLC 2010-2014. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Application)]
[Tooltip("Open a Mailto Url link in the browser or email client")]
public class ApplicationOpenUrlMailto : FsmStateAction
{
[Tooltip("Email Address")]
public FsmString inputEmail;
[Tooltip("Subject")]
public FsmString inputSubject;
[Tooltip("Body")]
public FsmString inputBody;
public override void OnEnter()
{
string email = inputEmail.Value;
string theSubject = inputSubject.Value;
string theBody = inputBody.Value;
string subject = MyEscapeURL(theSubject);
string body = MyEscapeURL(theBody);
Application.OpenURL("mailto:" + email + "?subject=" + subject + "&body=" + body);
Finish();
}
string MyEscapeURL (string url)
{
return WWW.EscapeURL(url).Replace("+","%20");
}
}
}
I hope someone else finds it useful.
Cheers