Advertisement
Guest User

Untitled

a guest
Jul 20th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.18 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7. using System.Net.Mail;
  8. using System.Net;
  9. using System.IO;
  10.  
  11. namespace ConsoleApplication1
  12. {
  13.     class Program
  14.     {
  15.         static void Main(string[] args)
  16.         {
  17.  
  18.  
  19.             int help = 0;
  20.             string line;
  21.             string line1;
  22.             string line2;
  23.             string line3;
  24.             string line4;
  25.             int counter = 0;
  26.             int a = 0;
  27.  
  28.  
  29.      
  30.  
  31.  
  32.  
  33.             MailMessage message = new MailMessage();
  34.  
  35.  
  36.  
  37.  
  38.  
  39.             message.IsBodyHtml = true;
  40.  
  41.  
  42.             SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
  43.             smtp.EnableSsl = true;
  44.             NetworkCredential netCre = new NetworkCredential("chenkadosh15@gmail.com", "chenkadosh1");
  45.             smtp.Credentials = netCre;
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.             bool PassportNumberExistanse = false;
  53.  
  54.  
  55.             string[] FullNames = new string[254];
  56.  
  57.             string[] Email = new string[254];
  58.             string[] PassportNumber = new string[254];
  59.  
  60.             StreamReader EmailReader = new StreamReader(@"C:\Users\Lenovoz710\Desktop\MyFiles\Email.txt");
  61.             StreamReader PassportNumberReader = new StreamReader(@"C:\Users\Lenovoz710\Desktop\MyFiles\PassportNumber.txt");
  62.  
  63.             StreamReader FullNameReader = new StreamReader(@"C:\Users\Lenovoz710\Desktop\MyFiles\Fullnames.txt");
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.             a = 0;
  73.  
  74.             while ((line = EmailReader.ReadLine()) != null && a < Email.Length)
  75.             {
  76.  
  77.  
  78.                 Email[a] = line;
  79.  
  80.  
  81.  
  82.  
  83.                 a++;
  84.  
  85.             }
  86.             a = 0;
  87.  
  88.  
  89.             while ((line2 = PassportNumberReader.ReadLine()) != null && a < Email.Length)
  90.             {
  91.                 PassportNumber[a] = line2;
  92.                 a++;
  93.  
  94.             }
  95.  
  96.          
  97.  
  98.  
  99.             a = 0;
  100.  
  101.             while ((line3 = FullNameReader.ReadLine()) != null && a < Email.Length)
  102.             {
  103.                 FullNames[a] = line3;
  104.                 a++;
  105.  
  106.             }
  107.             a = 0;
  108.            
  109.  
  110.             for (int i = 0; i < Email.Length; i++)
  111.             {
  112.                 if (PassportNumber[i] == null)
  113.                 {
  114.                     PassportNumberExistanse = true;
  115.                 }
  116.  
  117.                 if (PassportNumberExistanse)
  118.                 {
  119.                     message.From = new MailAddress(
  120.                 "liad.yogev.ly@gmail.com"
  121.               );
  122.  
  123.                     Console.Write("Sending E-mail to    ");
  124.                     Console.Write(Email[a]);
  125.                     Console.WriteLine("................................");
  126.  
  127.  
  128.                     message.To.Add(new MailAddress(Email[a]));
  129.  
  130.                     message.Subject = "Dear ";
  131.  
  132.                     message.Subject += FullNames[a];
  133.                    
  134.  
  135.  
  136.                    
  137.  
  138.  
  139.                     message.Body = FullNames[a];
  140.  
  141.  
  142.                     message.Body += ", Please provide us your passport Number";
  143.  
  144.                     smtp.Send(message);
  145.                     a++;
  146.                    
  147.  
  148.  
  149.                 }
  150.             }
  151.         }
  152.     }
  153. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement