2
/* vim: set expandtab tabstop=4 shiftwidth=4 encoding=utf-8: */
3
// +----------------------------------------------------------------------+
4
// | Eventum - Issue Tracking System |
5
// +----------------------------------------------------------------------+
6
// | Copyright (c) 2003 - 2008 MySQL AB |
7
// | Copyright (c) 2008 - 2010 Sun Microsystem Inc. |
9
// | This program is free software; you can redistribute it and/or modify |
10
// | it under the terms of the GNU General Public License as published by |
11
// | the Free Software Foundation; either version 2 of the License, or |
12
// | (at your option) any later version. |
14
// | This program is distributed in the hope that it will be useful, |
15
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17
// | GNU General Public License for more details. |
19
// | You should have received a copy of the GNU General Public License |
20
// | along with this program; if not, write to: |
22
// | Free Software Foundation, Inc. |
23
// | 59 Temple Place - Suite 330 |
24
// | Boston, MA 02111-1307, USA. |
25
// +----------------------------------------------------------------------+
26
// | Authors: Bryan Alsdorf <bryan@mysql.com> |
27
// +----------------------------------------------------------------------+
29
require_once 'init.php';
31
$full_message = Misc::getInput();
33
$structure = Mime_Helper::decode($full_message, false, true);
34
// TODO: Actually use values from config
36
// since this is all hacked up anyway, let's hardcode the values
37
if ((isset($structure->headers['to'])) && Routing::getMatchingIssueIDs($structure->headers['to'], 'email') !== false) {
38
$_SERVER['argv'][1] = '1';
39
$return = Routing::route_emails($full_message);
40
} elseif ((isset($structure->headers['to'])) && Routing::getMatchingIssueIDs($structure->headers['to'], 'note') !== false) {
41
$return = Routing::route_notes($full_message);
42
} elseif ((isset($structure->headers['to'])) && Routing::getMatchingIssueIDs($structure->headers['to'], 'draft') !== false) {
43
$return = Routing::route_drafts($full_message);
44
} elseif ((isset($structure->headers['cc'])) && Routing::getMatchingIssueIDs($structure->headers['cc'], 'email') !== false) {
45
$_SERVER['argv'][1] = '1';
46
$return = Routing::route_emails($full_message);
47
} elseif ((isset($structure->headers['cc'])) && Routing::getMatchingIssueIDs($structure->headers['cc'], 'note') !== false) {
48
$return = Routing::route_notes($full_message);
49
} elseif ((isset($structure->headers['cc'])) && Routing::getMatchingIssueIDs($structure->headers['cc'], 'draft') !== false) {
50
$return = Routing::route_drafts($full_message);
53
* TODO: Save other emails
54
// save this message in a special directory
55
$path = "/home/eventum/bounced_emails/";
56
list($usec,) = explode(" ", microtime());
57
$filename = date('d-m-Y.H-i-s.') . $usec . '.email.txt';
58
$fp = fopen($path . $filename, 'a+');
59
fwrite($fp, $full_message);
61
chmod($path . $filename, 0777);
63
// postfix uses exit code 67 to flag unknown users
64
$return = array(67, '');
67
if (is_array($return)) {
b'\\ No newline at end of file'