Hello,
I have a unity game that I am testing in a hospital, the game collects anonymous data and sends it to me via mail for analysis. Problem is that on itch.io i don't receive any mail.
using UnityEngine;
using UnityEngine.UI;
using System.Net;
using System.Net.Mail;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.IO;
using System;
using Random = System.Random;
public class Sending : MonoBehaviour
{
public InputField bodyMessage;
public string RandomString(int length)
{
Random rnd = new Random();
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
string randomis="";
for(int i = 0; i < length; i++)
{
char c = chars[rnd.Next(chars.Length)];
randomis += c;
}
return randomis;
}
public void SendEmail()
{
string randomised = RandomString(20);
System.IO.File.Move("Texting.txt", randomised+".txt");
string recipientEmail = "****************@gmail.com";
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
SmtpServer.Timeout = 10000;
SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
SmtpServer.UseDefaultCredentials = false;
SmtpServer.Port = 587;
mail.From = new MailAddress("*************@gmail.com");
mail.To.Add(new MailAddress(recipientEmail));
mail.Subject = "Test Email through C Sharp App";
mail.Body = bodyMessage.text;
System.Net.Mail.Attachment attachment;
attachment = new System.Net.Mail.Attachment(randomised + ".txt");
mail.Attachments.Add(attachment);
SmtpServer.Credentials = new System.Net.NetworkCredential("****************", "******************") as ICredentialsByHost; SmtpServer.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback = delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
};
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
SmtpServer.Send(mail);
}
}
I dunno what to do, and it is much more convenient to have an online version of the game . I am new to unity developpement, does anyone have an idea on what to do? or maybe another suggestion to get data from the game ?