Question by 
               youxue · Sep 24, 2017 at 09:30 AM · 
                c#build settings  
              
 
              How to use "System.Net.Mail.dll" When "Api Compatibility Level" is Net 2.0 Subset?
I tried to put the Net.Mail.dll in project , but it error with "Editor can only use assemblies targeting .Net 3.5 or lower".. Or is there a way to add a desired dll when the "Api Compatibility Level" is .Net 2.0 Subset ?
               Comment
              
 
               
              Answer by Bilelmnasser · Sep 26, 2017 at 03:01 PM
it's need to be : api compatibility is set to : net 2.0 (not the subset) and Stripping Level disabled
  using UnityEngine;
  using System.Collections;
  using System;
  using System.Net;
  using System.Net.Mail;
  using System.Net.Security;
  using System.Security.Cryptography.X509Certificates;
  
  public class mono_gmail : MonoBehaviour {
  
          void Main ()
          {
              MailMessage mail = new MailMessage();
  
              mail.From = new MailAddress("youraddress@gmail.com");
              mail.To.Add("youraddress@gmail.com");
              mail.Subject = "Test Mail";
              mail.Body = "This is for testing SMTP mail from GMAIL";
  
              SmtpClient smtpServer = new SmtpClient("smtp.gmail.com");
              smtpServer.Port = 587;
              smtpServer.Credentials = new System.Net.NetworkCredential("youraddress@gmail.com", "yourpassword") as ICredentialsByHost;
              smtpServer.EnableSsl = true;
              ServicePointManager.ServerCertificateValidationCallback = 
                  delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) 
                      { return true; };
              smtpServer.Send(mail);
              Debug.Log("success");
          
          }
  }
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                