hi everyone,
Thanks for taking your time for reading my issue. I doing now is about forgot password so when the username enter his/her username the system will send the email to user using my existing gmail account(mymail@gmail.com). So the issue i facing now it unable to send message to the user instead it throw exception “InvalidOperationException: SSL authentication error: RemoteCertificateNotAvailable, RemoteCertificateChainErrors”
private void SendEmail(string nEmail, string nPassword) {
// Create a System.Net.Mail.MailMessage object
MailMessage message = new MailMessage();
// Add a recipient
message.To.Add("\"" + nEmail + "\"");
// Add a message subject
message.Subject = "Email message from Curtis sent by Unity";
// Add a message body
message.Body = "Your password is: " + nPassword;
// Create a System.Net.Mail.MailAddress object and set the sender email address and display name.
message.From = new MailAddress("mymail@gmail.com", "Curtis in Unity");
// Create a System.Net.Mail.SmtpClient object and set the SMTP host and port number
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
// Create a System.Net.NetworkCredential object and set the username and password required by your SMTP account
smtp.Credentials = new System.Net.NetworkCredential("mymail@gmail.com", "12345678");
//Enable Secure Socket Layer (SSL) for connection encryption
smtp.EnableSsl = true;
// Do not send the DefaultCredentials with requests
smtp.UseDefaultCredentials = false;
// Send the message
smtp.Send(message);
}
Thanks…