Essential Kit
Loading...
Searching...
No Matches
MailComposersealed

The MailComposer class provides an interface to compose and send an email message. More...

Public Member Functions

void SetToRecipients (params string[] values)
 Sets the initial recipients to include in the email’s “To” field.
 
void SetCcRecipients (params string[] values)
 Sets the initial recipients to include in the email’s “Cc” field.
 
void SetBccRecipients (params string[] values)
 Sets the initial recipients to include in the email’s “Bcc” field.
 
void SetSubject (string value)
 Sets the initial text for the subject line of the email.
 
void SetBody (string value, bool isHtml=false)
 Sets the initial body text to include in the email.
 
void AddScreenshot (string fileName)
 Captures a screenshot and adds it as an attachment of the email.
 
void AddImage (Texture2D image, string fileName, TextureEncodingFormat textureEncodingFormat=TextureEncodingFormat.JPG)
 Adds specified image as an attachment of the email.
 
void AddAttachment (byte[] data, string mimeType, string fileName)
 Adds the specified data as an attachment of the email.
 
void SetCompletionCallback (EventCallback< MailComposerResult > callback)
 Specify the action to execute after the composer is dismissed.
 
void Show ()
 Shows the email composer interface with values initially set.
 

Static Public Member Functions

static MailComposer CreateInstance ()
 Initializes a new instance of the MailComposer class.
 
static bool CanSendMail ()
 Returns a Boolean indicating whether the current device is able to send email.
 

Detailed Description

Use this composer to display a standard email interface inside your app. Before presenting the interface, populate the fields with initial values for the subject, email recipients, body text, and attachments of the email. After presenting the interface, the user can edit your initial values before sending the email.

The following code example shows how to compose mail.

using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
public void Start()
{
{
// create new instance and populate fields
newComposer.SetSubject("Example");
newComposer.SetBody("Lorem ipsum dolor sit amet");
newComposer.AddScreenshot("screenshot.jpg");
newComposer.SetCompletionCallback(OnMailComposerClosed);
newComposer.Show();
}
else
{
// device doesn't support sending emails
}
}
private void OnMailComposerClosed(MailComposerResult result, Error error)
{
// add your code
}
}
The MailComposer class provides an interface to compose and send an email message.
Definition MailComposer.cs:61
void AddScreenshot(string fileName)
Captures a screenshot and adds it as an attachment of the email.
Definition MailComposer.cs:255
static bool CanSendMail()
Returns a Boolean indicating whether the current device is able to send email.
Definition MailComposer.cs:88
void SetCompletionCallback(EventCallback< MailComposerResult > callback)
Specify the action to execute after the composer is dismissed.
Definition MailComposer.cs:326
static MailComposer CreateInstance()
Initializes a new instance of the MailComposer class.
Definition MailComposer.cs:75
void SetBody(string value, bool isHtml=false)
Sets the initial body text to include in the email.
Definition MailComposer.cs:235
void SetSubject(string value)
Sets the initial text for the subject line of the email.
Definition MailComposer.cs:214
void Show()
Shows the email composer interface with values initially set.
Definition MailComposer.cs:338
This class contains the result of the user action which caused MailComposer interface to dismiss.
Definition MailComposerResult.cs:12
Namespace for essential kit features. You need to import this namespace along with VoxelBusters....
Definition AddressBook.cs:8

Member Function Documentation

◆ CanSendMail()

static bool CanSendMail ( )
static
Returns
true, if the device is configured for sending email, false otherwise.

◆ SetToRecipients()

void SetToRecipients ( params string[] values)
Parameters
valuesAn array of string values, each of which contains the email address of a single recipient.

◆ SetCcRecipients()

void SetCcRecipients ( params string[] values)
Parameters
valuesAn array of string values, each of which contains the email address of a single recipient.

◆ SetBccRecipients()

void SetBccRecipients ( params string[] values)
Parameters
valuesAn array of string values, each of which contains the email address of a single recipient.

◆ SetSubject()

void SetSubject ( string value)
Parameters
valueThe text to display in the subject line.

◆ SetBody()

void SetBody ( string value,
bool isHtml = false )
Parameters
valueThe initial body text of the message. The text is interpreted as either plain text or HTML depending on the value of the isHTML parameter..
isHtmlSpecify YES if the body parameter contains HTML content or specify NO if it contains plain text.

◆ AddScreenshot()

void AddScreenshot ( string fileName)
Parameters
fileNameThe preferred filename to associate with the image.

◆ AddImage()

void AddImage ( Texture2D image,
string fileName,
TextureEncodingFormat textureEncodingFormat = TextureEncodingFormat::JPG )
Parameters
imageThe image that has to be added as an attachment.
fileNameThe preferred filename to associate with the image.
textureEncodingFormatTexture encoding format.

◆ AddAttachment()

void AddAttachment ( byte[] data,
string mimeType,
string fileName )
Parameters
dataThe data of the file that has to be added as an attachment.
mimeTypeThe MIME type of the specified data.
fileNameThe filename of the specified data.

◆ SetCompletionCallback()

void SetCompletionCallback ( EventCallback< MailComposerResult > callback)
Parameters
callbackThe action to be called on completion.