Endless loop using port 465 with SMTP
I am trying to send an email from a Unity script using:
port 465
ssl enabled
host smtps.aruba.it
But no matter what or who I pray for blessings, Unity crashes in an endless loop.
I tried using smtps.gmail.com (using a different mail) with port 465 but it's still crashing.
Everything works as expected with port 587 & gmail host, but I have to stick to port 465 and aruba... I found old threads here and outside Unity community, but I found nothing that is "465-friendly",
Anyone faced similar issues with Unity && port 465 and have some suggestion?
The code is pretty default: ( c# )
void SendEmails(string sender, string password, string receiver, string subject, string text)
{
mail = new MailMessage();
mail.From = new MailAddress(sender);
mail.To.Add(receiver);
mail.Subject = subject;
mail.Body = text;
SmtpClient smtpServer = new SmtpClient("smtps.aruba.it");
smtpServer.Port = 465;
smtpServer.Credentials = new System.Net.NetworkCredential(sender, password) as ICredentialsByHost;
smtpServer.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback =
delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{ return true; };
smtpServer.Send(mail);
//smtpServer.SendAsync(mail)
Debug.Log("success");
}
SendEmails is used in a MonoBehaviour script. sender, receiver, password, subject, text are all filled with shiny, beautiful stringsss and when the method is called they are not null or empty.
I would gladly appreciate ANY kind of help, suggestion or share of pain.
yield return new WaitUntil( () => programmingHeroFound);
Your answer
![](https://koobas.hobune.stream/wayback/20220612185605im_/https://answers.unity.com/themes/thub/images/avi.jpg)