I’ve searched my question and found no conclusive answers.
I’ve implemented a c# script that succesfully sends email from the editor and standalone builds, but it relies on libraries that are not avaliable on the webplayer build (System.Net.Mail?).
My implementation follows:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using System.Net;
#if !UNITY_WEBPLAYER
using System.Net.Mail;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
public class MailHelper : MonoBehaviour
{
#region SINGLETON
private static MailHelper _instance;
public static MailHelper Instance
{
get
{
if (!_instance)
_instance = GameObject.FindObjectOfType(typeof(MailHelper)) as MailHelper;
return _instance;
}
}
#endregion
public void sendMailTest()
{
MailMessage tempMail = new MailMessage();
SmtpClient _smtp = new SmtpClient("smtp.gmail.com");
tempMail.From = new MailAddress("[SOME EMAIL ADRESS]");
tempMail.To.Add("[SOME EMAIL ADRESS]");
tempMail.Subject = "subject";
tempMail.Body = "text";
_smtp.Port = 587;
_smtp.Credentials = new System.Net.NetworkCredential("[SOME EMAIL ADRESS]", "[SOME PASSWORD]");
_smtp.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback =
delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
};
_smtp.Send(tempMail);
Debug.Log("sent");
}
}
#endif
Can someone point the way to a similar code that works both on standalone and webplayer builds?
Thanks in advance.