Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void EnvoyerMail ()
- {
- MailMessage mail = new MailMessage();
- mail.From = new MailAddress("xxxx@gmail.com");
- mail.To.Add("xxxx@gmail.com");
- mail.Subject = "Test Mail";
- mail.Body = "This is for testing SMTP mail from GMAIL";
- SmtpClient smtpServer = new SmtpClient("smtp.gmail.com");
- smtpServer.Port = 587;
- smtpServer.Credentials = new System.Net.NetworkCredential("xxxx@gmail.com", "password") as ICredentialsByHost;
- smtpServer.EnableSsl = true;
- ServicePointManager.ServerCertificateValidationCallback =
- delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
- { return true; };
- smtpServer.Send(mail);
- Debug.Log("success");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement