[英]unity3d sending email not working c#
i will introduce my self because i'm new to this..我将介绍我自己,因为我是新手。
my name is beau.. and i am a Game Developer and i have also a team that called VertexDevelopments.我的名字是 beau.. 我是一名游戏开发者,我还有一个叫做 VertexDevelopments 的团队。 i am also learning the general c# instead of c# unity.
我也在学习通用的 c# 而不是 c# unity。
so this is where i am stuck..所以这就是我被困的地方..
==================================ISSUE================================== ==================================问题============== ====================
i have a script that called feedback.我有一个叫做反馈的脚本。 i searched for the error but i can't find anything.
我搜索了错误,但我找不到任何东西。
i will get the error :我会得到错误:
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
at System.Net.Mail.SmtpClient.m__4 (System.Object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, SslPolicyErrors sslPolicyErrors) [0x00000] in :0在 System.Net.Mail.SmtpClient.m__4(System.Object 发件人,System.Security.Cryptography.X509Certificates.X509Certificate 证书,System.Security.Cryptography.X509Certificates.X509Chain 链,SslPolicyErrors sslPolicyErrors)[0x0000000000000000000000000
and this is the code what i currently have :这是我目前拥有的代码:
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);
}
}
========================================================================= ================================================== ========================
above the class i used :在我使用的课程之上:
UnityEngine.UI; UnityEngine.UI;
System;系统;
i hope i informed enough about this issue...我希望我对这个问题有足够的了解......
and also a very nice day,也是非常美好的一天,
Beau博
Are you sure, you want to enable SSL, as you do:您确定要启用 SSL,如下所示:
client.EnableSsl = true;
The error says it can't find a root certificate.错误说它找不到根证书。
Also you need to apply login credentials to gmail.您还需要将登录凭据应用于 gmail。
Thank you for the fast reply.. but i think should be the client.EnableSsl needs to be changed to false..感谢您的快速回复.. 但我认为应该是 client.EnableSsl 需要更改为 false..
but if i set it to false i will get this error :但如果我将其设置为 false,我会收到此错误:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.