40 if (!file_exists($this->_path)) {
41 if (!mkdir($this->_path, 0777,
true)) {
80 $this->_retryLimit = $limit;
94 $ser = serialize($message);
98 $fp = @fopen($fileName.
'.message',
'x');
100 if (
false === fwrite($fp, $ser)) {
121 foreach (
new DirectoryIterator($this->_path) as $file) {
122 $file = $file->getRealPath();
124 if (substr($file, -16) ==
'.message.sending') {
125 $lockedtime = filectime($file);
126 if ((time() - $lockedtime) > $timeout) {
127 rename($file, substr($file, 0, -8));
143 $directoryIterator =
new DirectoryIterator($this->_path);
147 foreach ($directoryIterator as $file) {
148 if (substr($file->getRealPath(), -8) ==
'.message') {
155 $failedRecipients = (array) $failedRecipients;
158 foreach ($directoryIterator as $file) {
159 $file = $file->getRealPath();
161 if (substr($file, -8) !=
'.message') {
166 if (rename($file, $file.
'.sending')) {
167 $message = unserialize(file_get_contents($file.
'.sending'));
169 $count += $transport->
send($message, $failedRecipients);
171 unlink($file.
'.sending');
199 $base =
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-';
201 $strlen = strlen($base);
202 for ($i = 0; $i < $count; ++$i) {
203 $ret .= $base[((int) rand(0, $strlen - 1))];