Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void SendMail(string subject, string body)
- {
- MailMessage mail = new MailMessage();
- mail.From = new MailAddress(mailAddress);
- mail.To.Add(mailAddress);
- mail.Subject = subject;
- mail.Body = body;
- SmtpClient smtpServer = new SmtpClient("smtp.gmail.com");
- smtpServer.Port = 587;
- smtpServer.Credentials = new NetworkCredential(mailAddress, mailPassword) as ICredentialsByHost;
- smtpServer.EnableSsl = true;
- ServicePointManager.ServerCertificateValidationCallback =
- delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
- { return true; };
- smtpServer.Send(mail);
- Debug.Log("mail success");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement