One Hat Cyber Team
Your IP :
216.73.216.135
Server IP :
194.44.31.54
Server :
Linux zen.imath.kiev.ua 4.18.0-553.77.1.el8_10.x86_64 #1 SMP Fri Oct 3 14:30:23 UTC 2025 x86_64
Server Software :
Apache/2.4.37 (Rocky Linux) OpenSSL/1.1.1k
PHP Version :
5.6.40
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
nosc
/
public_html
/
admin
/
lib
/
Swift
/
Edit File:
BatchMailer.php
<?php /** * Handles batch mailing with Swift Mailer with fail-safe support. * Restarts the connection if it dies and then continues where it left off. * Please read the LICENSE file * @copyright Chris Corbyn <chris@w3style.co.uk> * @author Chris Corbyn <chris@w3style.co.uk> * @package Swift * @license GNU Lesser General Public License */ class Swift_BatchMailer { /** * The current instance of Swift. * @var Swift */ protected $swift; /** * The maximum number of times a single recipient can be attempted before giving up. * @var int */ protected $maxTries = 2; /** * The number of seconds to sleep for if an error occurs. * @var int */ protected $sleepTime = 0; /** * Failed recipients (undeliverable) * @var array */ protected $failed = array(); /** * The maximum number of successive failures before giving up. * @var int */ protected $maxFails = 0; /** * Constructor. * @param Swift The current instance of Swift */ public function __construct(Swift $swift) { $this->setSwift($swift); } /** * Set the current Swift instance. * @param Swift The instance */ public function setSwift(Swift $swift) { $this->swift = $swift; } /** * Get the Swift instance which is running. * @return Swift */ public function getSwift() { return $this->swift; } /** * Set the maximum number of times a single address is allowed to be retried. * @param int The maximum number of tries. */ public function setMaxTries($max) { $this->maxTries = abs($max); } /** * Get the number of times a single address will be attempted in a batch. * @return int */ public function getMaxTries() { return $this->maxTries; } /** * Set the amount of time to sleep for if an error occurs. * @param int Number of seconds */ public function setSleepTime($secs) { $this->sleepTime = abs($secs); } /** * Get the amount of time to sleep for on errors. * @return int */ public function getSleepTime() { return $this->sleepTime; } /** * Log a failed recipient. * @param string The email address. */ public function addFailedRecipient($address) { $this->failed[] = $address; } /** * Get all recipients which failed in this batch. * @return array */ public function getFailedRecipients() { return $this->failed; } /** * Clear out the list of failed recipients. */ public function flushFailedRecipients() { $this->failed = null; $this->failed = array(); } /** * Set the maximum number of times an error can be thrown in succession and still be hidden. * @param int */ public function setMaxSuccessiveFailures($fails) { $this->maxFails = abs($fails); } /** * Get the maximum number of times an error can be thrown and still be hidden. * @return int */ public function getMaxSuccessiveFailures() { return $this->maxFails; } /** * Restarts Swift forcibly. */ protected function forceRestartSwift() { //Pre-empting problems trying to issue "QUIT" to a dead connection $this->swift->connection->stop(); $this->swift->connection->start(); $this->swift->disconnect(); //Restart swift $this->swift->connect(); } /** * NULLs out the To and From header in case Swift didn't get chance. * @param Swift_Message The message object */ protected function prepareMessageHeaders(&$message) { $message->headers->set("To", ""); $message->headers->set("Reply-To", ""); $message->headers->set("Return-Path", ""); $message->headers->set("From", ""); } /** * Run a batch send in a fail-safe manner. * This operates as Swift::batchSend() except it deals with errors itself. * @param Swift_Message To send * @param Swift_RecipientList Recipients (To: only) * @param Swift_Address The sender's address * @return int The number sent to */ public function send(Swift_Message $message, Swift_RecipientList $recipients, $sender) { $sent = 0; $this->prepareMessageHeaders($message); $successive_fails = 0; $it = $recipients->getIterator("to"); while ($it->hasNext()) { $it->next(); $recipient = $it->getValue(); $tried = 0; $loop = true; while ($loop && $tried < $this->getMaxTries()) { try { $tried++; $loop = false; $this->prepareMessageHeaders($message); $sent += $this->swift->send($message, $recipient, $sender); $successive_fails = 0; } catch (Exception $e) { $successive_fails++; if (($max = $this->getMaxSuccessiveFailures()) && $successive_fails > $max) { throw new Exception( "Too many successive failures. BatchMailer is configured to allow no more than " . $max . " successive failures."); } //If an exception was thrown, give it one more go if ($t = $this->getSleepTime()) sleep($t); $this->forceRestartSwift(); $loop = true; } } } return $sent; } }
Simpan