+ // if the mail was classified as Unsure, feed bogo
+ $raw_mail = html_entity_decode($client->get_pending_mail($list, $mid, 1));
+ // search for the X-Spam-Flag header
+ $end_of_headers = strpos($raw_mail, "\r\n\r\n");
+ if ($end_of_headers === false) { // sometimes headers are separated by \n
+ $end_of_headers = strpos($raw_mail, "\n\n");
+ }
+ $x_spam_flag = '';
+ if (preg_match('/^X-Spam-Flag: ([a-zA-Z]+), tests=bogofilter/m', substr($raw_mail, 0, $end_of_headers + 1), $matches)) {
+ $x_spam_flag = $matches[1];
+ }
+ if ($x_spam_flag == 'Unsure') {
+ $mailer = new PlMailer();
+ $mailer->addTo($type . '@' . $globals->mail->domain);
+ $mailer->setFrom('"' . $prenom . ' ' . $nom . '" <web@' . $globals->mail->domain . '>');
+ $mailer->setTxtBody($type . ' soumis par ' . $prenom . ' ' . $nom . ' via la modération de la liste ' . $list . '@' . $domain);
+ $mailer->addAttachment($raw_mail, 'message/rfc822', $type . '.mail', false);
+ $mailer->send();
+ }
+
+ // send feedback to the mailing list owners
+ if ($client->handle_request($list, $mid, $action, utf8_decode($reason))) {