Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by exerion · Dec 04, 2012 at 07:10 AM · iosstringemailsendopenurl

How do I send an email on IOS using Application.OpenURL with more than one line of body text?

This works...

 Application.OpenURL ("mailto:someone@gmail.com?subject=EmailSubject&body=EmailBody");

This doesn't...

 Application.OpenURL ("mailto:someone@gmail.com?subject=EmailSubject&body=Email\n\rBody");

Any help greatly appreciated :)

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image cregox · Dec 04, 2013 at 06:42 PM 0
Share

also http://answers.unity3d.com/questions/61669/applicationopenurl-for-email-on-mobile.html#answer-589705

4 Replies

· Add your reply
  • Sort: 
avatar image
5

Answer by Kryptos · Dec 04, 2012 at 09:09 AM

Did you try double-escaping the backslashes? Something like:

 Application.OpenURL ("mailto:someone@gmail.com?subject=EmailSubject&body=Email\\r\\nBody");

Or maybe you need to use HTML URL encoded entities.

 Application.OpenURL ("mailto:someone@gmail.com?subject=EmailSubject&body=Email%0D%0ABody");

Take also a look at C# verbatim string literals:

 @"first line blabla
 second line thingy."

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image stefann · Jul 15, 2013 at 01:47 PM 1
Share

the second answer (use HT$$anonymous$$L UTL encoded entities) works perfectly fine! thanks.

avatar image doanlinhit24 · Aug 07, 2018 at 07:49 AM 0
Share

thanks for help

avatar image
1

Answer by Shanlu · Aug 18, 2014 at 12:13 PM

You have to encode the url inorder to open it .Use the below link for encoding and decoding http://meyerweb.com/eric/tools/dencoder/

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by huminado · Apr 04, 2014 at 01:38 AM

%0A%0D

For your example:

Application.OpenURL ("mailto:someone@gmail.com?subject=EmailSubject&body=Email%0A%0DBody");

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by IMD · Jun 27, 2019 at 05:06 PM

Made up a little dynamic function off the Unity API which will 'smart escape' your url without messing with the root domain; enjoy.

  public static string SmartEscapeURL(string url) {
         
             string escapedArgs = "";
             string[] parts = url.Split('?');
             if (parts.Length == 1) return url;
             string[] args = parts[1].Split('&');
             for (int i = 0; i < args.Length; i++) {
                 string[] kvp = args[i].Split('=');
                 if (kvp.Length == 2) {
                     escapedArgs += String.Format("{0}={1}", 
                         WWW.EscapeURL(kvp[0]).Replace("+", "%20") , 
                         WWW.EscapeURL(kvp[1]).Replace("+", "%20"));
                     if (i < args.Length - 1) escapedArgs += "&";
                 }
             }
 
             string eUrl = parts[0] + "?" + escapedArgs;
             return eUrl;
         }

Isaac

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can't send email from ios device when email body contains arabic characters! 2 Answers

WWWForm.AddField maximum string length reached yields nullreference? 1 Answer

Accessing iOS mail? 0 Answers

Send HTML email to native email client 3 Answers

How to send an email with an attachment ios U3DXT 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges