簡體   English   中英

unity3d 發送電子郵件不起作用 c#

[英]unity3d sending email not working c#

我將介紹我自己,因為我是新手。

我的名字是 beau.. 我是一名游戲開發者,我還有一個叫做 VertexDevelopments 的團隊。 我也在學習通用的 c# 而不是 c# unity。

所以這就是我被困的地方..

==================================問題============== ====================

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

我會得到錯誤:

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)[0x0000000000000000000000000

這是我目前擁有的代碼:

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("vertexdevelopments2016@gmail.com");
        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.UI;

  • 系統;

  • System.Collections;
  • System.Net.Mail;
  • System.Net.Sockets;
  • 系統文本;

我希望我對這個問題有足夠的了解......

也是非常美好的一天,

您確定要啟用 SSL,如下所示:

client.EnableSsl = true;

錯誤說它找不到根證書。

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

感謝您的快速回復.. 但我認為應該是 client.EnableSsl 需要更改為 false..

但如果我將其設置為 false,我會收到此錯誤:

問題如果是假的

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM