-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmail_next.php
45 lines (31 loc) · 1.27 KB
/
mail_next.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/******************************************************************************/
/* Includes */
/******************************************************************************/
include_once(dirname(__FILE__) . "/phpbatchmail.lib.php");
/******************************************************************************/
/* Main */
/******************************************************************************/
$workingDirectory = getcwd();
chdir(dirname(__FILE__));
$properties = parse_ini_file("properties.ini", true);
$i = $properties["General"]["number_of_mails"];
if ($handle = opendir("mail_queue")) {
while (false !== ($file = readdir($handle)) && $i != 0) {
$fullName = "./mail_queue/" . $file;
if (is_file($fullName)) {
$mail = json_decode(file_get_contents($fullName));
if ($mail) {
if (mail($mail->to, $mail->subject, $mail->message, $mail->headers, $mail->parameters)) {
unlink($fullName);
}
if ($i > 0) {
--$i;
}
}
}
}
closedir($handle);
}
chdir($workingDirectory);
?>