I made a game, with unity, how could i make a control to know when somebody really win the game automatic send me a code or something like that. To prevent fraud.
This gonna happened when the player load level finish, them the security message or email i received.
Any sugestion?
How can i put this to work, on loadLevel, please.
here the script.
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 {
void Main ()
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress("youraddress@gmail.com");
mail.To.Add("youraddress@gmail.com");
mail.Subject = "Test Mail";
mail.Body = "This is for testing SMTP mail from GMAIL";
SmtpClient smtpServer = new SmtpClient("smtp.gmail.com");
smtpServer.Port = 587;
smtpServer.Credentials = new System.Net.NetworkCredential("youraddress@gmail.com", "yourpassword") as ICredentialsByHost;
smtpServer.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback =
delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{ return true; };
smtpServer.Send(mail);
Debug.Log("success");
}
}
In your game-over scene create an Empty Game object, then add a C# script to it and call that script mono_gmail. In that script copy the code you pasted here, but change the word Main with the word Start
when i hit play in Unity, i receive the email (This is for testing SMTP mail from GMAIL).
But when i start the application in the Iphone, nothing happend, the script just work when hit play in unity computer.
How can i fix that?