• 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
1
Question by hvilela · Aug 21, 2013 at 09:27 PM · attachmentapplication.openurl

Mailto with attachment

Application.OpenURL("mailto:?subject=test&body=test&attachment=" + filePath);

it does open the mail program, but do not include the file. Am I doing something wrong? There's any way to do that with unity?

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by ArkaneX · Aug 21, 2013 at 10:33 PM

Standard mailto protocol does not support attachments (see specification).

If I'm not wrong, attachment support was provided by Microsoft in older MS Outlook versions, but in newer versions RFC compliant protocol is implemented.

Comment
Add comment · Show 3 · 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 hvilela · Aug 21, 2013 at 11:32 PM 0
Share

Thanks for the fast answer. Do you see any alternative to create a new email in the default mail program with an atached file?

avatar image ArkaneX · Aug 22, 2013 at 12:24 AM 2
Share

It depends what you require. If you need to launch client program, so that your user mail account and his/her mail server is used, then without control over this program you can't add any attachment automatically.

If, on the other hand, you don't have to display anything and just send the message using mail account provided by you, then you should be able to add an attachment. Please take a look at answer to this question.

To include attachment, you have to add the following lines to the code from above answer:

 string attachmentPath = @"C:\somefile.txt";
 System.Net.$$anonymous$$ail.Attachment attachment = new System.Net.$$anonymous$$ail.Attachment(attachmentPath);
 mail.Attachments.Add(attachment);

There's an important issue related to the ServicePoint$$anonymous$$anager.ServerCertificateValidationCallback used in the code. Basically, it is a way of preventing the certificate errors during access to hosts via SSL. Using it is unsafe, at least in the form from linked code, so that it always return true, ignoring all errors. If you're going to play with this code, you definitely have to read about this callback.

And finally - if callback will be used, it should be initialized once, for example in Awake method of some global object.

avatar image Bloodysoft · Jul 17, 2014 at 09:59 PM 0
Share

That's only a partial example from another post. The mail.Attachments is from the $$anonymous$$ail$$anonymous$$essage class, so it won't work with the Ops question. You forgot to add the most important part. $$anonymous$$ail$$anonymous$$essage mail = new $$anonymous$$ail$$anonymous$$essage(); and use smtp not mailto:

avatar image
0

Answer by johnbrisoff236 · Oct 27, 2013 at 06:16 PM

Work with ms outlook data with the aid of .pst repair tool outlook 2007 download

Article http://www.outlook.repairtoolboxx.com/how-to-repair-outlook.html must immediately aid you

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

18 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 avatar image

Related Questions

How does one implement create-a-class? 1 Answer

Trouble Animating a Character using a Bow in Blender and exporting to Unity 0 Answers

Attaching equipment to a character 1 Answer

How to open a pdf on android device from streaming assets folder 4 Answers

How can I join 2 objects when objectB enter in objectA' s collider? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges