简体   繁体   中英

PHP Mass mailer not sending all mail

so what I am doing is coding a script for me to personally stress test my softwares ability to recieve emails (I am working on a simple email client). Basically, it should just send as many emails as I tell it to send to my email address. Here is the code:

$i=0; 
while ($i < $numberofemails) { 
        $m = rand(10e16, 10e20);

    $n = base_convert($m, 10, 36);

$subject = 'Test';

mail("myemail@gmail.com", $subject, $message, null, "-f" . $n . "@mydomain.com"); 
$i++; 
} 

The script works, but it does not send all of the emails that I tell it to (or atleast recieve all the emails.) It ussually only recieves less then half, and then sometimes it will recieve some, then a few hours later randomly recieve a few more. Any idea why this happens? I tried it with gmail and AOL also. Is there a better way to send email for this?

There's nothing in the script that would give the required information to diagnose the issue. You'd have to watch the traffic or look in mail logs.

Note that many destinations rate-limit people who try to send to them, including gmail, aol, and many others. If you suddenly start sending significantly more email in a short period of time than you normally do, then they'll make you wait before sending more. The actual limits are generally secret and seem to vary based on your behavior.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM