unity 发送邮件
unity 发送邮件
wu_hua_gou 发表于1年前
unity 发送邮件
  • 发表于 1年前
  • 阅读 28
  • 收藏 0
  • 点赞 0
  • 评论 0

【腾讯云】新注册用户域名抢购1元起>>>   

 public void SendEmail()
    {
        //MailMessage mail = new MailMessage();

        //mail.From = new MailAddress("1311845207@qq.com");
        //mail.To.Add("1311845207@qq.com");
        //mail.Subject = "Test Mail";
        //mail.Body = "This is for testing SMTP mail from GMAIL";
        //mail.Attachments.Add(new Attachment("02.png"));

        //SmtpClient smtpServer = new SmtpClient("smtp.qq.com");
        //smtpServer.Credentials = new System.Net.NetworkCredential("1311845207@qq.com", "131313525252LS") as ICredentialsByHost;
        //smtpServer.EnableSsl = true;
        //ServicePointManager.ServerCertificateValidationCallback =
        //    delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
        //    { return true; };

        //smtpServer.Send(mail);
        //Debug.Log("success");

        SmtpClient mailClient = new SmtpClient("smtp.qq.com");
        mailClient.EnableSsl = true;
        //Credentials登陆SMTP服务器的身份验证.
        mailClient.Credentials = new NetworkCredential("2934064674@qq.com", "nsmotmppvijodhde") as ICredentialsByHost;
        //test@qq.com发件人地址、[url=mailto:test@tom.com]test@tom.com[/url]收件人地址
        MailMessage message = new MailMessage(new MailAddress("2934064674@qq.com"), new MailAddress("1311845207@qq.com"));

        // message.Bcc.Add(new MailAddress("tst@qq.com")); //可以添加多个收件人
        message.Body = "Hello Word!";//邮件内容
        message.Subject = "this is a test2";//邮件主题
        //Attachment 附件
        Attachment att = new Attachment(@"02.png");
        message.Attachments.Add(att);//添加附件
        Console.WriteLine("Start Send Mail....");

        ServicePointManager.ServerCertificateValidationCallback =
            delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
            { return true; };
        //发送....
        mailClient.Send(message);
    }

 

标签: Unity3D
  • 打赏
  • 点赞
  • 收藏
  • 分享
共有 人打赏支持
粉丝 0
博文 2
码字总数 85
×
wu_hua_gou
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: