We use Google Apps, and I'm not paying them for dozens of inboxes just for each departments tickets.. (when nicknames are free)
This mod allows "one inbox" to be checked for messages, messages can then be properly forwarded to the correct department according to the admin rules configured for each email within osTicket. Otherwise osTicket assigns whatever emailId is associated with the inbox doing the checking. (emailId in this case refers to the id number of the administatively defined email address inside osTicket). You can't achieve this with filters as the "to" address isn't passed along. If you haven't configured the alias, it will still receive the inbox's department, so no worries.
Implementation:
I created a new mailbox, because otherwise it will download all the old email. I configured this account to enable POP and set it to Archive POP'd messages (in the user web-interface of the account). If you have an empty account, you can use that if you wish.
Then create the aliases ((Google Apps instructions)). This differs per server, but they are usually free.
Then create each alias as a unique "Email" config in osTicket, (/scp/emails.php) thus giving each alias their own emailId in the system. However do not set these to connect and download, for all intents and purposes they are "disabled" to osTicket, this just means they do not get automatically checked, which in this instance is useful as they don't exist! But we need them to be there, so we can configure things like priorities's and departments.
Open: /include/class.mailfetch.php
Replace function getHeaderInfo with this:
function getHeaderInfo($mid) {
if (!($headerinfo = imap_headerinfo($this->mbox, $mid)) || !$headerinfo->from)
return null;
$sender = $headerinfo->from;
$addressee = $headerinfo->to;
//Just what we need...
$header = array('name' => @$sender->personal,
'email' => (strtolower($sender->mailbox) . '@' . $sender->host),
'subject' => @$headerinfo->subject,
'mid' => $headerinfo->message_id,
'to' => (strtolower($addressee->mailbox). '@' . $addressee->host)
);
return $header;
}
Find $emailId = $this->getEmailId(); inside createTicket($mid)
Replace with:
$emailId = (isset($mailinfo)) ? Email:($mailinfo) : $this->getEmailId();
That should do it. Now messages addressed to: service@you.com should actually lookup the service@you.com settings inside your configs and correctly route the incoming message.
Forgive me if this has already been done, I couldn't find it. Also, I spent AGES inside class.mailparse.php only to discover that it doesn't really do anything.. :-(
I'm off to learn git so I can submit this.. could be useful.