-
Notifications
You must be signed in to change notification settings - Fork 0
/
mono_gmail.cs
54 lines (45 loc) · 1.57 KB
/
mono_gmail.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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
{
private MainGameController gameController;
private SmtpClient smtpServer;
private MailMessage mail;
private bool sendMail = true;
void Start()
{
Debug.Log("End of the game");
gameController = GameObject.Find("MainGameController").GetComponent<MainGameController>();
mail = new MailMessage();
mail.From = new MailAddress("[email protected]");
mail.To.Add("[email protected]");
//mail.Subject = gameController.part_id;
mail.Body = gameController.sb.ToString();
smtpServer = new SmtpClient("smtp.gmail.com");
smtpServer.Port = 587;
smtpServer.Credentials = new System.Net.NetworkCredential("[email protected]", "keepondancing") as ICredentialsByHost;
smtpServer.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback =
delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{ return true; };
//smtpServer.Send(mail);
//Debug.Log("success");
}
void Update()
{
print(gameController.part_id);
if(gameController.part_id!=""&&sendMail)
{
mail.Subject = gameController.part_id;
smtpServer.Send(mail);
Debug.Log("success");
sendMail = false;
}
}
}