a89c45a51e7c4506b132c6655b537517ede6dfc1
4 * mailto.php -- mailto: url handler
6 * Copyright (c) 1999-2003 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This checks to see if we're logged in. If we are we open up a new
10 * compose window for this email, otherwise we go to login.php
11 * (the above functionality has been disabled, by default you are required to
14 * Use the following url to use mailto:
15 * http://<your server>/<squirrelmail base dir>/src/mailto.php?emailaddress="%1"
16 * see ../contrib/squirrelmail.mailto.reg for a Windows Registry file
17 * @package squirrelmail
20 /** Path for SquirrelMail required files. */
21 define('SM_PATH','../');
23 /* SquirrelMail required files. */
24 require_once(SM_PATH
. 'config/config.php');
25 require_once(SM_PATH
. 'functions/global.php');
27 header('Pragma: no-cache');
28 if(!sqgetGlobalVar('emailaddress', $emailaddress)) {
32 $mailto_pos = strpos(strtolower($emailaddress), 'mailto:');
33 if($mailto_pos !== false) {
34 $emailaddress = substr($emailaddress, $mailto_pos+
7);
35 $_GET['emailaddress'] = $emailaddress;
37 if(($pos = strpos($emailaddress, '?')) !== false) {
38 $a = substr($emailaddress, $pos+
1);
39 list($emailaddress, $a) = explode('?', $emailaddress, 2);
40 $a = explode('=', $a, 2);
41 $_GET['emailaddress'] = $emailaddress;
44 $trtable = array('emailaddress' => 'send_to',
46 'bcc' => 'send_to_bcc',
48 'subject' => 'subject');
50 /* CC, BCC, etc could be any case, so we'll fix them here */
51 foreach($_GET as $k=>$g) {
55 $url .= $k . '=' . urlencode($g) . '&';
58 $url = substr($url, 0, -1);
60 sqsession_is_active();
61 /* Check to see if we're logged in */
63 if (sqsession_is_registered('user_is_logged_in')) {
64 $redirect = 'webmail.php?right_frame=compose.php?';
66 $redirect = 'login.php?mailto=';
69 $url = urlencode($url);
70 /* $redirect .= $url; */
71 $redirect = 'login.php?mailto=' . $url;
72 session_write_close();
73 header('Location: ' .get_location(). $redirect);