Send email using JAVA not C# Nearly there!

I am trying to send an email from in game. I am trying to modify the C# script that has been posted here in the past, however, It crashes when I get to "ServicePointManager.ServerCertificateValidationCallback = delegate(System.Object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) ". I don’t know how to translate this to Java. How can I changes this so it will compile in java?

function Start () {

var mail: MailMessage  = new MailMessage();
mail.From = new MailAddress("rogiedodgie@gmail.com");
mail.To.Add("rogiedodgie@gmail.com");
mail.Subject = "Test Mail";
mail.Body = "This is for testing SMTP mail from GMAIL using JAVA";

var smtpServer: SmtpClient = new SmtpClient("smtp.gmail.com");
smtpServer.Port = 587;
smtpServer.Credentials = new System.Net.NetworkCredential("myemailname@gmail.com", "mypassword") as ICredentialsByHost;
smtpServer.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback = 
delegate(System.Object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) 
{ return true; };
smtpServer.Send(mail);
Debug.Log("success");

}

function Update () {

}

[1] is not UnityScript (Unity's proprietary language with a [JavaScript][2] inspired syntax). Edit your question and say at least JavaScript or UnityScript. Java is a completely different language. (And don't say something that within the context of Unity it's obvious that you mean UnityScript since Java might actually be used when you build for Android).

Apart from that UnityScript has a different syntax for creating anonymous functions.

    ServicePointManager.ServerCertificateValidationCallback = function(s, certificate, chain, sslPolicyErrors) { return true; };


  [1]: https://en.wikipedia.org/wiki/Java_%28programming_language%29
  [2]: https://en.wikipedia.org/wiki/JavaScript

You might be better off in the stackoverflow forum since this is not really a Unity related question