Unity3d 技巧(12) -Unity3d发送邮件
来源:互联网 发布:线切割锥度怎样编程 编辑:程序博客网 时间:2024/06/05 15:41
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 SendEmailSrc : MonoBehaviour
{
void OnGUI()
{
if (GUI.Button(new Rect(0, 50, 100, 40), "Capture"))
{
Debug.Log("Capture Screenshot");
Application.CaptureScreenshot("screen.png");
}
if (GUI.Button(new Rect(0, 0, 100, 40), "Send"))
{
SendEmail();
}
}
private void SendEmail()
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress("1213250243@qq.com");
mail.To.Add("1213250243@qq.com");
mail.Subject = "Test Mail";
mail.Body = "This is for testing SMTP mail from GMAIL";
mail.Attachments.Add(new Attachment("screen.png"));
SmtpClient smtpServer = new SmtpClient("smtp.qq.com");
smtpServer.Credentials = new System.Net.NetworkCredential("1213250243@qq.com", "密码") as ICredentialsByHost;
smtpServer.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback =
delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{ return true; };
smtpServer.Send(mail);
Debug.Log("success");
using System.Collections;
using System;
using System.Net;
using System.Net.Mail;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
public class SendEmailSrc : MonoBehaviour
{
void OnGUI()
{
if (GUI.Button(new Rect(0, 50, 100, 40), "Capture"))
{
Debug.Log("Capture Screenshot");
Application.CaptureScreenshot("screen.png");
}
if (GUI.Button(new Rect(0, 0, 100, 40), "Send"))
{
SendEmail();
}
}
private void SendEmail()
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress("1213250243@qq.com");
mail.To.Add("1213250243@qq.com");
mail.Subject = "Test Mail";
mail.Body = "This is for testing SMTP mail from GMAIL";
mail.Attachments.Add(new Attachment("screen.png"));
SmtpClient smtpServer = new SmtpClient("smtp.qq.com");
smtpServer.Credentials = new System.Net.NetworkCredential("1213250243@qq.com", "密码") 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
- Unity3d 技巧(12) -Unity3d发送邮件
- Unity3d发送邮件
- Unity3d发送邮件
- Unity3D 发送消息小技巧
- unity3d实现发送带附件的邮件
- Unity3D -- 调用手机端发送邮件功能
- Unity3D技巧
- Unity3D技巧
- Unity3D-Android直接使用系统自带邮件发送反馈
- Unity3D-调用Android系统邮件发送邮件,或调用系统分享去分享内容
- Unity3D小技巧
- Unity3D使用小技巧
- Unity3D模型优化技巧
- Unity3D渲染优化技巧
- Unity3d优化技巧
- Unity3D使用小技巧
- Unity3d 杂七杂八小技巧
- Unity3D学习技巧
- iOS终极横竖屏切换解决方案
- codeoforces832D
- 商城项目开发遇到的问题记录(一)
- [左偏树]CODE[VS] 1063——合并果子
- Scala简介
- Unity3d 技巧(12) -Unity3d发送邮件
- NSColorList—— an ordered list of NSColor objects, identified by keys.
- SQL优化之基于SQL特征的改写
- 轻量全面的硬件检测工具——Speccy中文版评测
- centos mysql 安装,启动命令
- 【bzoj2563】阿狸和桃子的游戏
- Qt连接并操作SQL数据库(Qt学习①)
- opencv学习资源
- http(tcp/ip)