Game Development Reference
In-Depth Information
Listing 8.4 Prepopulating Email Data in a Unity Application
Before Sending
private var toEmail = "";
private var nameField = "My Name";
private var messageField = "Message";
function OnGUI()
toEmail = GUI.TextField (Rect (100, 10, 200, 50), toEmail);
nameField = GUI.TextField (Rect (100, 60, 200, 50),
messageField = GUI.TextArea(Rect(100, 120, 200, 200),
Application.OpenURL("mailto:" + toEmail + "?" +
"subject=Test Email&" +
"body=From: " +
nameField + "\n" + messageField);
Step 6. Play. An email form will be created in the Unity app as shown
in Figure 8.6 . When send is pressed the information entered will be
sent to the user's email client.
The format for a mailto string should be mailto:email_address?email
_information . The question mark always separates the email address of
the recipient with extra data, which are divided into a number of headers
separated by ampersands. Each header has a name and its own value set
with an equals sign. The headers can include:
subject—the text that will appear in the subject line
body—the email message
cc—the email address of others to send a copy of the message
bcc—the email address of others who will receive the email but
not appear in the send email message of the original
Search Nedrilad ::

Custom Search