0

send email every 5 second and show output then send next and show output after again 5 second i send email first i fetch email from csv file and send email and i want every email send after 5 second.

here is my code

<?php
$row              = 1;

if (($handle      = fopen("Email.csv", "r")) !== FALSE) {
  $wait=0;
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        $num      = count($data);
        $row++;
        $to          =implode($data); // as per your CSV shown in question.
        $subject     = 'Your subject';
        $message     = 'Your mail content';
        $headers     =  "From: ar742812@gmail.com";
        mail($to, $subject, $message, $headers);
        $array = explode(' ', $to);
        $wait += 3000;
?>
<script type="text/javascript" src="jquery.js"></script>
<script>
var iterateMe = <?=json_encode($array)?>;
$.each(iterateMe,function(index, value) {
  setTimeout (function(){
  document.write((index+1) + ": " + value);
  document.write('=running after 3seconds <br>');
},<?php echo $wait; ?>);
  });
</script> 
<?php
    }
}
?>

send email every 5 second and show output then send next and show output after again 5 second

0 Answers0