Beispiel #1
0
         }
         $mail_ids[$entry['id']] = $new_id;
     }
     // select all redirs for this address
     $mail_redir = $exdb->queryAllRecords("SELECT id, mn_id, address FROM mail_redir WHERE mn_id = '" . $entry['id'] . "'");
     foreach ($mail_redir as $redir) {
         $params = array('server_id' => $server_id, 'source' => $entry['mail_name'] . "@" . $parent_domain['name'], 'destination' => $redir['address'], 'type' => 'forward', 'active' => yes_no(1));
         $old_mail = $app->db->queryOneRecord("SELECT forwarding_id FROM mail_forwarding WHERE source = '" . $entry['mail_name'] . "@" . $parent_domain['name'] . "' AND destination = '" . $redir['address'] . "'");
         if ($old_mail) {
             $new_id = $old_mail['forwarding_id'];
             $ok = $importer->mail_forward_update($session_id, $client_id, $new_id, array_merge($old_mail, $params));
             if ($ok === false) {
                 $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
             }
         } else {
             $new_id = $importer->mail_forward_add($session_id, $client_id, $params);
         }
         if ($new_id === false) {
             //something went wrong here...
             $msg .= "Mail redirect " . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . " to " . $redir['address'] . ") could not be inserted/updated.<br />";
             $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
         } else {
             $msg .= "Mail redirect " . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . " to " . $redir['address'] . ") inserted/updated.<br />";
         }
     }
     unset($mail_redir);
 }
 unset($mail_addresses);
 $mail_aliases = $exdb->queryAllRecords("SELECT a.id, a.mn_id, a.alias, m.dom_id, m.mail_name FROM mail_aliases as a INNER JOIN mail as m ON (m.id = a.mn_id)");
 foreach ($mail_aliases as $entry) {
     $parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");