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
0
Question by Jack-Mariani · Oct 04, 2014 at 02:06 PM · emailmail

Can't access to gmail using the build

Hi everyone. I need to send an email using the game and I've this issue.

When I try the game in the editor it sends the mail correctly.

When I build the game and I try to send the email using the .exe file it raises this:


Platform assembly: D:\DropBox Storage\Dropbox\Project\Exec\Exec PC\Updated version\OSR_Data\Managed\Mono.Security.dll (this message is harmless) SmtpException: 530-5.5.1 Authentication Required. Learn more at

530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 l10sm4506847wif.20 - gsmtp

at System.Net.Mail.SmtpClient.SendCore (System.Net.Mail.MailMessage message) [0x00000] in :0

at System.Net.Mail.SmtpClient.SendInternal (System.Net.Mail.MailMessage message) [0x00000] in :0

at System.Net.Mail.SmtpClient.Send (System.Net.Mail.MailMessage message) [0x00000] in :0


The Code I'm using is the following:

 static public void mono_gmail (string receiver, string subject, string body)
     {
         MailMessage mail = new MailMessage();

         //mail content here
         mail.From = new MailAddress(sampleemail@gmail.com, "Name");
         mail.To.Add(receiver);
         mail.Subject = subject;
         mail.Body = body;

         //attaching a file here
         System.Net.Mail.Attachment data;
         data = new System.Net.Mail.Attachment("filePathhere");
         mail.Attachments.Add(data);
 
         SmtpClient smtpServer = new SmtpClient(senderSmtp);
         smtpServer.Port = 587;
 
         smtpServer.Credentials = new System.Net.NetworkCredential(senderEmail, senderPassword) as ICredentialsByHost;
            smtpServer.EnableSsl = true;
         ServicePointManager.ServerCertificateValidationCallback = 
         delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) 
         { return true; };
         
         smtpServer.Send(mail);
         Debug.Log("success");
         
     }
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
8
Best Answer

Answer by Jack-Mariani · Oct 06, 2014 at 07:29 AM

I just need to change Api Compatibility Level from ".NET 2.0 Subset" to ".NET 2.0".

You can find it in player settings (File->Build Settings...->Player Settings...->OtherSettings)

Found the solutions in these answers:

http://answers.unity3d.com/questions/378545/send-an-email-from-the-game.html http://answers.unity3d.com/questions/397992/sending-email-from-unity-works-in-editor-not-in-st.html

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 Kraato5 · Nov 06, 2017 at 01:25 PM 0
Share

God bless you, mate. Saved my week!

avatar image ryvianstyron · Jan 27, 2018 at 07:59 AM 0
Share

LIFE SAVER! Thank you Jack-$$anonymous$$ariani <3

avatar image phygitalmadhouse · Jul 29, 2018 at 06:14 PM 0
Share

Lovely and sweet

avatar image
0

Answer by codemaker2015 · Dec 21, 2021 at 02:52 PM

Ensure that you have changed Internet access from auto to require in Player settings --> other settings --> configuration

Use this reference to create application specified password.

https://stackoverflow.com/a/70435444/7103882

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

8 People are following this question.

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

Related Questions

How to send a e-mail via smtp 0 Answers

Unknown Host Exception when attempting to send a mail from Android, but not editor 0 Answers

Sending email from within Unity using smtp service 1 Answer

Send email works in Editor, not on tablet 2 Answers

Can the webplayer send emails? 0 Answers


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