<?   
ob_start();   

$basla = $_GET["basla"] ? $_GET["basla"] : 0; // Kactan baslayacak?   
$limit = 5;                                   // Kac tanesıne gonderecek?   
$bekle = 2;                                   // Kac sanıye bekleyecek?   

$konu  = "Test";   
$mesaj = "<b>...</b>";   

$ustk  = "From: xxx <xxx@xxx.com>\\n";   
$ustk .= "X-Sender: <xxx@xxx.com>\\n";   
$ustk .= "X-Mailer: PHP\\n";   
$ustk .= "X-Priority: 3\\n";   
$ustk .= "Return-Path: <xxx@xxx.com>\\n";   
$ustk .= "Content-Type: text/html; charset=iso-8859-9\\n";   

if($dosya = (fopen("mail.txt",'r'))){   
    while(!feof($dosya)){   
        $satir  = trim(fgets($dosya,50));   
        if($satir != "") $mail[] = $satir;   
    }   
    fclose($dosya);   

    for($i=$basla; $i<$basla+$limit; $i++){   
        if($mail[$i] != ""){   
            echo $mail[$i]."<br>";   
            mail($mail[$i], $konu, $mesaj, $ustk);   
        }   
    }   

    echo "<br>Gönderilen $basla, ".($basla+$limit)." arası toplam ".($basla+$limit)." mail. ";   
    if(count($mail) > ($basla+$limit)){   
        echo "Kalan ".(count($mail) - ($basla+$limit))." mail.";   
        header("refresh: $bekle; url=mail.php?basla=".($basla+$limit)); // Sayfayı yenıle   
    }   
}else {  
    echo "Hata: Dosya açılamıyor.";   
}  
?>