2016-04-23 20 views
-1

我會介紹我自己,因爲我是新來的..unity3d發送電子郵件不工作C#

我的名字是情人..我是一個遊戲開發者,我也有一個團隊,叫做VertexDevelopments。我也在學習一般的c#而不是c#的統一。

所以這是我堅持..

================================= = ISSUE ==================================

我有一個腳本,稱爲反饋。我搜索了錯誤,但我找不到任何東西。

我會得到錯誤:

System.Net.Mail.SmtpException: Message could not be sent. ---> System.IO.IOException: The authentication or decryption has failed. ---> System.InvalidOperationException: SSL authentication error: RemoteCertificateNotAvailable, RemoteCertificateChainErrors 

在System.Net.Mail.SmtpClient.m__4(System.Object的發件人,System.Security.Cryptography.X509Certificates.X509Certificate證書,System.Security.Cryptography。 X509Certificates.X509Chain鏈,SslPolicyErrors sslPolicyErrors)[0x00000]在:0

和這是代碼我目前有:

public InputField yourEmail; 
public InputField issue; 

public MailMessage mail = new MailMessage(); 
public SmtpClient client = new SmtpClient("smtp.gmail.com"); 

public void SendingFeedback(){ 

    try { 
     mail.From = new MailAddress(yourEmail.text.ToString()); 
     mail.To.Add("[email protected]"); 
     mail.Subject = "test user"; 
     mail.Body = "this is for testing smpt mail from gmail"; 

     client.Port = 587; 
     client.Host = "smtp.gmail.com"; 
     client.EnableSsl = true; 
     client.Timeout = 1000; 

     client.DeliveryMethod = SmtpDeliveryMethod.Network; 
     client.UseDefaultCredentials = false; 

     mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure; 

     client.Send(mail); 
    } 

    catch(Exception ex){ 
     Debug.Log (ex); 
    } 
} 

=========== ================================================== ============

我使用的類以上:

  • UnityEngine;
  • UnityEngine.UI;

  • 系統;

  • System.Collections;
  • System.Net.Mail;
  • System.Net.Sockets;
  • System.Text;

我希望我足夠資料對這個問題......

,也是一個非常愉快的一天,

回答

0

你確定,要啓用SSL,爲你做:

client.EnableSsl = true; 

錯誤表示找不到根證書。

此外,您還需要將登錄憑據應用於gmail。

0

謝謝你的回覆快..但我認爲應該是client.EnableSsl需要更改爲假..

,但如果我將它設置爲false,我會得到這個錯誤:

ISSUE if false