资源简介
没有封装之类的,需要的可以看下。unity发送邮件的简易源码;
代码片段和文件信息
using System.Text;
using System.Net.Mail;
using UnityEngine;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Net.Security;
using System.Threading;
using UnityEngine.UI;
public class MailManager : MonoBehaviour
{
public string user;
public string password;
public string host;
public int port;
public InputField title;
public InputField receive;
public InputField content;
private MailMessage m_Msg;
private SmtpClient m_Client;
void Start ()
{
SetMailMessage(user);
SetSmtpClient(host port user password);
ServicePointManager.ServerCertificateValidationCallback = RemoteCertificateValidationCallback;
}
private void SetMailMessage(string userStr)
{
m_Msg = new MailMessage();
m_Msg.From = new MailAddress(userStr);
}
private void SetSmtpClient(string hostStrint portIntstring userStrstring passwordStr)
{
m_Client = new SmtpClient(hostStr);
m_Client.Port = portInt;
m_Client.EnableSsl = true;
m_Client.Credentials = new NetworkCredential(userStr passwordStr) as ICredentialsByHost;
}
public bool RemoteCertificateValidationCallback(object sender X509Certificate certificate X509Chain chain SslPolicyErrors sslPolicyErrors)
{
return true;
}
public void Send()
{
Thread t = new Thread(() => { m_Client.Send(m_Msg); });
t.Start();
}
public void titleEnd()
{
string message = title.text;
m_Msg.Subject = message;
m_Msg.SubjectEncoding = Encoding.UTF8;
Debug.Log(“标题:“ + message);
}
public void ReceiveEnd()
{
string message = receive.text;
m_Msg.To.Add(message);
Debug.Log(“收件人:“ + message);
}
public void ContentEnd()
{
string message = content.text;
m_Msg.Body = message;
m_Msg.BodyEncoding = Encoding.UTF8;
Debug.Log(“邮件内容:“ + message);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-11-30 16:41 Test_Mail\
目录 0 2017-11-30 16:40 Test_Mail\.vs\
目录 0 2017-11-30 16:40 Test_Mail\.vs\New Unity Project\
目录 0 2017-11-30 16:40 Test_Mail\.vs\New Unity Project\v15\
文件 134144 2017-11-30 13:39 Test_Mail\.vs\New Unity Project\v15\.suo
文件 241664 2017-11-29 19:22 Test_Mail\.vs\New Unity Project\v15\Browse.VC.db
目录 0 2017-11-30 16:40 Test_Mail\.vs\Test_Unet\
目录 0 2017-11-30 16:40 Test_Mail\.vs\Test_Unet\v15\
文件 41472 2017-11-30 15:58 Test_Mail\.vs\Test_Unet\v15\.suo
目录 0 2017-11-30 16:40 Test_Mail\Assets\
目录 0 2017-11-30 16:40 Test_Mail\Assets\Scenes\
文件 191 2017-11-30 13:03 Test_Mail\Assets\Scenes.me
文件 47560 2017-11-30 15:39 Test_Mail\Assets\Scenes\QQMail.unity
文件 174 2017-11-29 19:18 Test_Mail\Assets\Scenes\QQMail.unity.me
目录 0 2017-11-30 16:40 Test_Mail\Assets\sc
文件 191 2017-11-30 13:03 Test_Mail\Assets\sc
文件 2091 2017-11-30 15:40 Test_Mail\Assets\sc
文件 262 2017-11-30 13:49 Test_Mail\Assets\sc
目录 0 2017-11-30 16:40 Test_Mail\Library\
文件 4116 2017-11-24 17:34 Test_Mail\Library\AnnotationManager
文件 2926420 2017-11-30 16:39 Test_Mail\Library\assetDataba
文件 9 2017-11-30 13:49 Test_Mail\Library\AssetImportState
文件 4756 2017-11-30 16:39 Test_Mail\Library\AssetServerCacheV3
文件 14336 2017-11-29 11:06 Test_Mail\Library\AssetVersioning.db
文件 0 2017-11-24 17:34 Test_Mail\Library\BuildPla
文件 4152 2017-11-24 17:34 Test_Mail\Library\BuildSettings.asset
文件 18387 2017-11-30 16:40 Test_Mail\Library\CurrentLayout.dwlt
文件 4480 2017-11-30 13:49 Test_Mail\Library\EditorUserBuildSettings.asset
文件 4192 2017-11-27 09:15 Test_Mail\Library\EditorUserSettings.asset
文件 4188 2017-11-30 16:40 Test_Mail\Library\expandedItems
文件 4168 2017-11-29 16:01 Test_Mail\Library\InspectorExpandedItems.asset
............此处省略4894个文件信息
- 上一篇:微信小程序背单词小程序.zip
- 下一篇:windows10mac主题包.zip
评论
共有 条评论