0
\$\begingroup\$

I want to send an email in a WebGL build using C#. My code is as below

try
{
   Uri myUri = new Uri("mailto:anemailaddress@example.com? Subject=Hello%20again&body=TEST");
   System.Diagnostics.Process.Start(myUri.AbsoluteUri);
}
catch (Win32Exception e)
{
  Debug.LogError(e.Message);
}
catch (Exception e)
{
   Debug.LogError(e.Message);
}

to open an email client. But I get the following error as well as a Win32Exception : Success error

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/WebGL/runtime/DebugBindings.gen.cpp Line: 51)

a9b4b6fe-b629-4efc-bb29-821d1f0fcea2:9085:3 Not implemented icall: Process::ShellExecuteEx_internalUnityLoader.js:3541:3 Success

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/WebGL/runtime/DebugBindings.gen.cpp Line: 51)

\$\endgroup\$
1
\$\begingroup\$

The solution is to use Application.OpenURL instead of Process.Start

Example:

Application.OpenURL("mailto:someone@gmail.com?Subject=Hello%20again&body=TEST");
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.