Sending email with attachment

Hi all,

I just wanted to send an email through unity with the screenshot of the screen(iPad screen) as attachment.

Currently I came across to this for emailing :

           Application.OpenURL("mailto:?subject=subject&body=bodytesting");

Also I am using ReadPixels for saving my screenshot.

So please help me here with forwarding the screenshot as attachment.

thanks in advance…

a)
With Unity 2017 I had to replace the obsolete Application.CaptureScreenshot
with ScreenCapture.CaptureScreenshot(Application.persistentDataPath + “\bug.png”);
screenshot on pc confirmed in C:\Users\username\AppData\LocalLow\packagename\gamename
With Android I used ScreenCapture.CaptureScreenshot(“bug.png”); which placed
the file into the package folder


b)
Application.OpenUrl("mailto:?s …
opened gmail on android with subject and body but did not add the Attachment - maybe a security feature?
I put several file types (zip, png, txt) in the Application.persistentDataPath to attach but none worked

You can use the following plugin from asset store for iOS and android. Plugins are cheap and developer provides really nice support.

iOS : Email Composer in iOS | Integration | Unity Asset Store

ANDROID: Email Composer For Android | Integration | Unity Asset Store

  1. save screenshot to file:

    Application.CaptureScreenshot(Application.persistentDataPath + “\screen.png”);

  2. Open url with attachment :

    Application.OpenUrl(“mailto:?subject=subject&body=bodytesting&Attachment=”+Application.persistentDataPath+ “\screen.png”);