Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Drawing;
- using System.Windows.Forms;
- using System.Net.Mail;
- using System.Net;
- using System.IO;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int help = 0;
- string line;
- string line1;
- string line2;
- string line3;
- string line4;
- int counter = 0;
- int a = 0;
- MailMessage message = new MailMessage();
- message.IsBodyHtml = true;
- SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
- smtp.EnableSsl = true;
- NetworkCredential netCre = new NetworkCredential("chenkadosh15@gmail.com", "chenkadosh1");
- smtp.Credentials = netCre;
- bool PassportNumberExistanse = false;
- string[] FullNames = new string[254];
- string[] Email = new string[254];
- string[] PassportNumber = new string[254];
- StreamReader EmailReader = new StreamReader(@"C:\Users\Lenovoz710\Desktop\MyFiles\Email.txt");
- StreamReader PassportNumberReader = new StreamReader(@"C:\Users\Lenovoz710\Desktop\MyFiles\PassportNumber.txt");
- StreamReader FullNameReader = new StreamReader(@"C:\Users\Lenovoz710\Desktop\MyFiles\Fullnames.txt");
- a = 0;
- while ((line = EmailReader.ReadLine()) != null && a < Email.Length)
- {
- Email[a] = line;
- a++;
- }
- a = 0;
- while ((line2 = PassportNumberReader.ReadLine()) != null && a < Email.Length)
- {
- PassportNumber[a] = line2;
- a++;
- }
- a = 0;
- while ((line3 = FullNameReader.ReadLine()) != null && a < Email.Length)
- {
- FullNames[a] = line3;
- a++;
- }
- a = 0;
- for (int i = 0; i < Email.Length; i++)
- {
- if (PassportNumber[i] == null)
- {
- PassportNumberExistanse = true;
- }
- if (PassportNumberExistanse)
- {
- message.From = new MailAddress(
- "liad.yogev.ly@gmail.com"
- );
- Console.Write("Sending E-mail to ");
- Console.Write(Email[a]);
- Console.WriteLine("................................");
- message.To.Add(new MailAddress(Email[a]));
- message.Subject = "Dear ";
- message.Subject += FullNames[a];
- message.Body = FullNames[a];
- message.Body += ", Please provide us your passport Number";
- smtp.Send(message);
- a++;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement