代码拉取完成,页面将自动刷新
class Program
{
static void Main(string[] args)
{
SmtpClient mailClient = new SmtpClient("smtp.qq.com");
mailClient.EnableSsl = true;
//Credentials登陆SMTP服务器的身份验证.
mailClient.Credentials = new NetworkCredential("1213250243@qq.com", "");
//test@qq.com发件人地址、test@tom.com收件人地址
MailMessage message = new MailMessage(new MailAddress("1213250243@qq.com"), new MailAddress("aladdingame@qq.com"));
// message.Bcc.Add(new MailAddress("tst@qq.com")); //可以添加多个收件人
message.Body = "Hello Word!";//邮件内容
message.Subject = "this is a test";//邮件主题
//Attachment 附件
Attachment att = new Attachment(@"D:/test.mp3");
message.Attachments.Add(att);//添加附件
Console.WriteLine("Start Send Mail....");
//发送....
mailClient.Send(message);
Console.WriteLine("Send Mail Successed");
Console.ReadLine();
}
}
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");
}
}
欢迎关注我的围脖
==================== 迂者 丁小未 CSDN博客专栏=================
我的QQ:1213250243 Unity QQ群:375151422
====================== 相互学习,共同进步 ===================
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型