我正在开发一个应用程序,我正在建立它。这是一个评论应用程序,可将评论直接发送给所有者的电子邮件地址。问题是该应用程序在Unity上播放时工作正常,电子邮件发送得很好,但在移动设备上不会发生同样的情况。我仍然是编码的新手。
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
{
public GameObject gameController;
public void onSubmitButton()
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress("sender_emailId");
mail.To.Add("recipient_EmailId");
mail.Subject = "Review";
mail.Body = gameController.GetComponent<AppController>().reviewSend;
SmtpClient smtpServer = new SmtpClient("smtp.gmail.com");
smtpServer.Port = 587;
smtpServer.Credentials = new System.Net.NetworkCredential("sender_emailId", "sender_pass") as ICredentialsByHost;
smtpServer.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback =
delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{ return true; };
smtpServer.Send(mail);
Debug.Log("success");
}
}
答案 0 :(得分:0)
在编辑器中打开播放器设置,并将API兼容级别更改为NET 2.0(不要使用.NET 2.0子集,这将删除一些不会误认为的API)并再次部署。 VOILA你的问题消失了:-D