1 Index: include/class.support.php
2 ===================================================================
3 --- include/class.support.php (revision 3290)
4 +++ include/class.support.php (working copy)
9 + * Bounce message to sender.
12 + * @param object $message parsed message structure.
13 + * @param array array(ERROR_CODE, ERROR_STRING) of error to bounce
16 + function BounceEmail($message, $error)
18 + // open text template
19 + $tpl = new Template_API;
20 + $tpl->setTemplate('notifications/bounced_email.tpl.text');
21 + $tpl->bulkAssign(array(
22 + 'error_code' => $error[0],
23 + 'error_message' => $error[1],
24 + 'date' => $message->date,
25 + 'subject' => Mime_Helper::fixEncoding($message->subject),
26 + 'from' => Mime_Helper::fixEncoding($message->fromaddress),
27 + 'to' => Mime_Helper::fixEncoding($message->toaddress),
28 + 'cc' => Mime_Helper::fixEncoding(@$message->ccaddress),
31 + $sender_email = Mail_API::getEmailAddress($message->fromaddress);
32 + $usr_id = User::getUserIDByEmail($sender_email);
33 + // change the current locale
35 + Language::set(User::getLang($usr_id));
38 + $text_message = $tpl->getTemplateContents();
40 + // send email (use PEAR's classes)
41 + $mail = new Mail_API;
42 + $mail->setTextBody($text_message);
43 + $setup = $mail->getSMTPSettings();
44 + $mail->send($setup['from'], $sender_email,
45 + APP_SHORT_NAME . ': ' . ev_gettext('Postmaster notify: see transcript for details'));
48 + Language::restore();
53 * Method used to get the information about a specific message
54 * from a given mailbox.
57 $res = Routing::getMatchingIssueIDs($addresses, 'email');
59 $return = Routing::route_emails($message);
60 - if ($return == true) {
61 + if ($return === true) {
62 Support::deleteMessage($info, $mbox, $num);
65 + // TODO: handle errors?
70 $res = Routing::getMatchingIssueIDs($addresses, 'note');
72 $return = Routing::route_notes($message);
73 - if ($return == true) {
74 + if ($return === true) {
75 Support::deleteMessage($info, $mbox, $num);
80 + Support::BounceEmail($email, $return);
85 $res = Routing::getMatchingIssueIDs($addresses, 'draft');
87 $return = Routing::route_drafts($message);
88 - if ($return == true) {
89 + if ($return === true) {
90 Support::deleteMessage($info, $mbox, $num);
93 + // TODO: handle errors?
97 Index: templates/notifications/bounced_email.tpl.text
98 ===================================================================
99 --- templates/notifications/bounced_email.tpl.text (revision 0)
100 +++ templates/notifications/bounced_email.tpl.text (revision 0)
102 +----- {t escape=no}Eventum was unable to route your email{/t} -----
105 +----- {t escape=no}The original message headers follow{/t} -----