Skip to content

Instantly share code, notes, and snippets.

@voxelbustersold
Created August 30, 2019 13:28
Show Gist options
  • Save voxelbustersold/e89a3af4d9230ddd5b097e78285ca240 to your computer and use it in GitHub Desktop.
Save voxelbustersold/e89a3af4d9230ddd5b097e78285ca240 to your computer and use it in GitHub Desktop.
CPNP 2.0 Mail Sharing
using UnityEngine;
using System.Collections;
using VoxelBusters.NativePlugins;
public class ExampleClass : MonoBehaviour
{
public void Start()
{
if (MailComposer.CanSendMail())
{
// create new instance and populate fields
new MailComposer()
.SetSubject("Example")
.SetBody("Lorem ipsum dolor sit amet")
.AddScreenshot("screenshot.jpg")
.SetCompletionCallback(OnMailComposerClosed) //Call AddImage with byte array and more options
.Show();
}
else
{
// device doesn't support sending emails
}
}
private void OnMailComposerClosed(IMailComposerClosedCallbackResult result)
{
// add your code
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment