All fixed!
I had the wrong variable from the beginning.
The variable that represents the address that the Email was sent to is:
After finding that i added this if statement:
Code:
if ($email->to_addrs == "support@xxx.com") {
$type = 'Support';
} else {
$type = 'Voicemail';
}
$c = new aCase();
$this->getCaseIdFromCaseNumber($email->name, $c);
if (!$this->handleCaseAssignment($email) && $this->isMailBoxTypeCreateCase()) {
// create a case
$GLOBALS['log']->debug('retrieveing email');
$email->retrieve($email->id);
$c = new aCase();
$c->description = $email->description;
$c->assigned_user_id = $userId;
$c->name = $email->name;
$c->status = 'New';
$c->type = $type;
$c->account_id = '2ed3443c-62b2-798d-fab2-4b4ead46df31';
$c->priority = 'P1';
if(!empty($email->reply_to_email)) {
$contactAddr = $email->reply_to_email;
} else {
$contactAddr = $email->from_addr;
}
Bookmarks