The following Code which was working previously suddenly stopped working. Anyone have any idea what’s causing it or how to fix it ?
using System.Net;
using System.Net.Mail;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text.RegularExpressions;
public void sendMail (string targetEmail, string subject, string content){
MailMessage mail = new MailMessage();
mail.From = new MailAddress(acEmail);
mail.To.Add(targetEmail);
mail.Subject = subject;
mail.Body = content;
SmtpClient smtpServer = new SmtpClient("smtp.gmail.com");
smtpServer.Port = 587;
smtpServer.Credentials = new System.Net.NetworkCredential(acEmail, acPW) as ICredentialsByHost;
smtpServer.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback =
delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{ return true; };
smtpServer.Send(mail);
Debug.Log("Email Sent");
}
The Error Message shows the following :