예제 #1
0
 * @copyright 2012 Jakob Sack <*****@*****.**>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('mail');
$account_id = isset($_GET['account_id']) ? $_GET['account_id'] : null;
$folder_id = isset($_GET['folder_id']) ? $_GET['folder_id'] : null;
$message_id = isset($_GET['message_id']) ? $_GET['message_id'] : null;
$message = OCA\Mail\App::getMessage(OCP\User::getUser(), $account_id, $folder_id, $message_id);
if ($message['error']) {
    OCP\JSON::error(array('data' => array('message' => $message['error'])));
    exit;
}
$tmpl = new OCP\Template('mail', 'part.message');
$tmpl->assign('message', $message['message'], false);
$page = $tmpl->fetchPage();
OCP\JSON::success(array('data' => $page));
예제 #2
0
<?php

/**
 * ownCloud - Addressbook
 *
 * @author Thomas Tanghus
 * @copyright 2012 Jakob Sack <*****@*****.**>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('mail');
$account_id = isset($_GET['account_id']) ? $_GET['account_id'] : null;
$folder_id = isset($_GET['folder_id']) ? $_GET['folder_id'] : null;
$from = isset($_GET['from']) ? $_GET['from'] : null;
$count = isset($_GET['count']) ? $_GET['count'] : null;
$messages = OCA\Mail\App::getMessages(OCP\User::getUser(), $account_id, $folder_id, $from, $count);
OCP\JSON::success(array('data' => $messages));
예제 #3
0
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('mail');
$account_id = isset($_GET['account_id']) ? $_GET['account_id'] : null;
$subject = isset($_GET['subject']) ? $_GET['subject'] : null;
$body = isset($_GET['body']) ? $_GET['body'] : null;
$to = isset($_GET['to']) ? $_GET['to'] : null;
$account = OCA\Mail\App::getAccount(OCP\User::getUser(), $account_id);
if (!$account) {
    // TODO: i10n
    OCP\JSON::error(array('data' => array('message' => 'Unknown account')));
    exit;
}
// get sender data
$from = $account->getName();
$from_address = $account->getEMailAddress();
// parse receiver string
$parser = new Horde_Mail_Rfc822();
$tos = $parser->parseAddressList($to, array('validate' => true));
foreach ($tos as $t) {
    // sent mail
    OCP\Util::sendMail($t->bare_address, $t->label, $subject, $body, $from_address, $from);
}
예제 #4
0
 * @author Thomas Tanghus
 * @copyright 2012 Jakob Sack <*****@*****.**>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('mail');
$accounts = OCA\Mail\App::getFolders(OCP\User::getUser());
foreach ($accounts as $account) {
    if (isset($account['error'])) {
        OCP\JSON::error(array('data' => array('message' => $account['error'])));
        exit;
    }
}
$tmpl = new OCP\Template('mail', 'part.folders');
$tmpl->assign('accounts', $accounts);
$page = $tmpl->fetchPage();
OCP\JSON::success(array('data' => $page));
예제 #5
0
/**
 * ownCloud - Mail
 *
 * @author Thomas Müller
 * @copyright 2012 Thomas Müller <*****@*****.**>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('mail');
$term = isset($_GET['term']) ? $_GET['term'] : null;
$receivers = OCA\Mail\App::getMatchingRecipient($term);
if (isset($receivers['error'])) {
    OCP\JSON::error(array('data' => array('message' => $receivers['error'])));
    exit;
}
OCP\JSON::encodedPrint($receivers);
예제 #6
0
파일: add.php 프로젝트: netcon-source/apps
/**
 * ownCloud - Mail
 *
 * @author Thomas Müller
 * @copyright 2012 Thomas Müller
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('mail');
$host = isset($_GET['host']) ? $_GET['host'] : null;
$user = isset($_GET['user']) ? $_GET['user'] : null;
$email = isset($_GET['email']) ? $_GET['email'] : null;
$password = isset($_GET['password']) ? $_GET['password'] : null;
$port = isset($_GET['port']) ? $_GET['port'] : null;
$ssl_mode = isset($_GET['ssl_mode']) ? $_GET['ssl_mode'] : null;
$id = OCA\Mail\App::addAccount(OCP\User::getUser(), $email, $host, $port, $user, $password, $ssl_mode);
OCP\JSON::success(array('data' => array('id' => $id)));
예제 #7
0
 * @copyright 2012 Thomas Müller
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('mail');
$email_address = isset($_POST['email_address']) ? $_POST['email_address'] : null;
$password = isset($_POST['password']) ? $_POST['password'] : null;
if (!$email_address || !filter_var($email_address, FILTER_VALIDATE_EMAIL)) {
    OCP\JSON::error(array('message' => 'email'));
    exit;
}
$id = OCA\Mail\App::autoDetectAccount(OCP\User::getUser(), $email_address, $password);
if ($id == null) {
    OCP\JSON::error(array('data' => array('message' => 'Auto detect failed. Please use manual mode.')));
} else {
    OCP\JSON::success(array('data' => array('id' => $id)));
}