} $maildir = str_replace("[domain]", $parent_domain["name"], $mail_config["maildir_path"]); $maildir = str_replace("[localpart]", strtolower($entry["mail_name"]), $maildir); $params = array('server_id' => $server_id, 'email' => $entry['mail_name'] . "@" . $parent_domain['name'], 'login' => strtolower($entry['mail_name'] . "@" . $parent_domain['name']), 'password' => $entry['password'], 'name' => $entry[''], 'quota' => $entry['mbox_quota'] == -1 ? 0 : $entry['mbox_quota'], 'cc' => $entry['redir_addr'], 'maildir' => $maildir, 'homedir' => $mail_config["homedir_path"], 'uid' => $mail_config["mailuser_uid"], 'gid' => $mail_config["mailuser_gid"], 'postfix' => yes_no(1), 'disableimap' => yes_no(0), 'disablepop3' => yes_no(0), 'autoresponder_subject' => $has_responder ? $responder['subject'] : '', 'autoresponder_text' => $has_responder ? $responder['text'] : '', 'autoresponder' => yes_no($has_responder ? 1 : 0), 'autoresponder_start_date' => $has_responder && $responder['resp_on'] === 'true' ? strftime('%Y-%m-%d', time()) : strftime('%Y-%m-%d', time() - 3600 * 24), 'autoresponder_end_date' => $has_responder && $responder['resp_on'] === 'true' ? strftime('%Y-%m-%d', time() + 3600 * 24 * 365) : strftime('%Y-%m-%d', time()), 'move_junk' => yes_no(0)); $client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]]; // if this is no postbox we do not need to create a mailuser if ($entry['postbox'] !== 'false') { $old_mail = $app->db->queryOneRecord("SELECT mailuser_id FROM mail_user WHERE email = '" . $entry['mail_name'] . "@" . $parent_domain['name'] . "'"); if ($old_mail) { $new_id = $old_mail['mailuser_id']; $ok = $importer->mail_user_update($session_id, $client_id, $new_id, array_merge($old_mail, $params)); if ($ok === false) { $msg .= " Error: " . $importer->getFault() . "<br />"; } } else { $new_id = $importer->mail_user_add($session_id, $client_id, $params); } if ($new_id === false) { //something went wrong here... $msg .= "Mail" . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . ") could not be inserted/updated.<br />"; $msg .= " Error: " . $importer->getFault() . "<br />"; } else { $msg .= "Mail " . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . ") inserted/updated.<br />"; add_command('rsync -av --delete-after --modify-window 10 --progress -e ssh root@${MYSERVER}:/var/qmail/mailnames/' . $parent_domain['name'] . '/' . strtolower($entry['mail_name']) . '/Maildir/ ' . $maildir . '/Maildir/'); add_command('chown -R vmail:vmail ' . $maildir); add_command('chmod 744 ' . $maildir . '/Maildir/subscriptions'); add_command('chmod 600 ' . $maildir . '/Maildir/dovecot-*'); add_command('chmod 700 ' . $maildir . '/Maildir/cur ' . $maildir . '/Maildir/new ' . $maildir . '/Maildir/tmp'); add_command('chmod 600 ' . $maildir . '/Maildir/cur/* ' . $maildir . '/Maildir/new/* ' . $maildir . '/Maildir/tmp/*'); } $mail_ids[$entry['id']] = $new_id;