Advertisement
Guest User

Untitled

a guest
Jan 7th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using System;
  4. using System.Net;
  5. using System.Net.Mail;
  6. using System.Net.Security;
  7. using System.Security.Cryptography.X509Certificates;
  8.  
  9. public class MailManager : MonoBehaviour
  10. {
  11.     public static void SendMail(string message)
  12.     {
  13.         MailMessage mail = new MailMessage();
  14.  
  15.         mail.From = new MailAddress("FromAddress@gmail.com");
  16.         mail.To.Add("ToAddress@gmail.com");
  17.         mail.Subject = "Rocket Fist Error log";
  18.         mail.Body = message;
  19.  
  20.         SmtpClient smtpServer = new SmtpClient("smtp.gmail.com");
  21.         smtpServer.Port = 587;
  22.         smtpServer.Credentials = new System.Net.NetworkCredential("FromAddress@gmail.com", "Password") as ICredentialsByHost;
  23.         smtpServer.EnableSsl = true;
  24.  
  25.         ServicePointManager.ServerCertificateValidationCallback =
  26.             delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
  27.             { return true; };
  28.         smtpServer.Send(mail);
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement