Random email
This commit is contained in:
parent
a1c1244e14
commit
750c910d7d
2 changed files with 28 additions and 3 deletions
|
|
@ -56,8 +56,29 @@ if (isset ($_POST['send']))
|
|||
|
||||
// @TODO: Send mail to the selected validator
|
||||
|
||||
// Get an email from the list
|
||||
|
||||
$file = fopen('email.txt', 'r');
|
||||
$number = fgets($file);
|
||||
|
||||
while (true)
|
||||
{
|
||||
$random = rand(1, $number);
|
||||
|
||||
for ($i = 0; $i < $random; $i++)
|
||||
{
|
||||
$line = fgets($file);
|
||||
}
|
||||
if ($line != $_POST['email'])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose($file);
|
||||
|
||||
/* This code works, perhaps should be placed in a method in Question class?
|
||||
$to = "bertrand.cournaud@gmail.com";
|
||||
$to = $line;
|
||||
$subject = "[Nemubot] Validation d'une question";
|
||||
$headers = "From: Nemubot <bot@nemunai.re>";
|
||||
$message = 'Bonjour,\n Adresse de validation:
|
||||
|
|
|
|||
Reference in a new issue