0

I'm trying to send some mail, but they not working. It's very strange because sometimes the mail has been send correctly, but the most part of time this not work. But in the other script the function work correctly. That's my code:

I send a mail as test for check the correct work of the function:

    <?php
set_time_limit(0);
$sendMail = FALSE;
$to = "salvatorelafragola@elettronew.com";
$subject = "TESTFINAL";
$text = "TESTFINAL";
$headers = 'From: develettronew@testelettronw.com' . "\r\n" .
    'Reply-To: salvatorelafragola@elettronew.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
# File Italiano
mail($to , $subject, $text, $headers);

Ans in this part, sometimes the mail is send. But not the most part of the time. And here, it never work:

foreach ($resultEs_uno as $fileOdierno) {
    foreach ($resultEs_due as $filePrecedente) {
        if ( $fileOdierno[1] !== $filePrecedente[1] && $fileOdierno[0] == $filePrecedente[0]){
            //$textMail .= "\n\n"."URL file odierno: <b>".$fileOdierno[1]. "</b>"."\n\n"."URL file pecedente: <b>". $filePrecedente[1] . "</b>\n\n";
            fputcsv($file,array($fileOdierno[1], $filePrecedente[1]),";");
            $sendMail = TRUE;
        }
    }
}

fclose($product_dinamica_es);
fclose($product_dinamica_es_pre);
//rename("product-dinamica-es.csv", "product-dinamica-es-pre.csv");

fclose($file);

# Se il flag รจ true parte la mail per Enzo
if ($sendMail == TRUE){
    mail('salvatorelafragola@elettronew.com', 'Alcuni URL sono variati', "Alcuni URL sono variati, controlla il report.", $headers) ;
    exit("Script terminato. Alcuni URL sono cambiati.");   
} else {
    exit("Script terminato.");   

Thing still more weird, i receive the mail after a lot of time..How is possible?

s.elettro
  • 55
  • 1
  • 8
  • Do you send 1 Mail a time or do you try to send more Emails per time? Is it a private or hostet server? โ€“ Z0OM Mar 16 '22 at 09:57
  • I tryied to send more mail a time, i did all possibles test...But on 100 time, i receive the mail 3 time... โ€“ s.elettro Mar 16 '22 at 09:59
  • Maybe this is a security reason from the hoster not to spam. Aks your hoster/provider if you can send a lot of emails per time. โ€“ Z0OM Mar 16 '22 at 10:01

0 Answers0