Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 KB | None | 0 0
  1. using System;
  2. using System.Net.Mail;
  3. using System.Net;
  4. using System.Security.Cryptography.X509Certificates;
  5. using System.Net.Security;
  6.  
  7. namespace smtp_test
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             ServicePointManager.ServerCertificateValidationCallback =
  14.                         delegate (
  15.                             object s,
  16.                             X509Certificate certificate,
  17.                             X509Chain chain,
  18.                             SslPolicyErrors sslPolicyErrors
  19.                         )
  20.                         {
  21.                             return true;
  22.                         };
  23.             try
  24.             {
  25.                 SmtpClient cl = new SmtpClient("gekkoin.com", 25);
  26.                 MailAddress from = new MailAddress("reports@gekkoin.com");
  27.                 MailAddress to = new MailAddress("reports@gekkoin.com");
  28.                 MailMessage msg = new MailMessage(from, to);
  29.                 msg.Body = "test";
  30.                 cl.Credentials = new NetworkCredential("Gekkoin", "xK201ipD9OH3qmDro8O3xdm");
  31.                 cl.EnableSsl = true;
  32.                 cl.Send(msg);
  33.                 msg.Dispose();
  34.             }
  35.             catch (Exception ex)
  36.             {
  37.                 Console.WriteLine(ex);
  38.             }
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement