From: indiri69 Date: Tue, 22 Apr 2003 21:36:51 +0000 (+0000) Subject: Basic mailto: support. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c67e4479e74125ff1afe3177f27399e76787442c;p=squirrelmail.git Basic mailto: support. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4788 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/ChangeLog b/ChangeLog index aa9b0563..bb38cd4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,8 @@ Version 1.5.0 -- CVS - conf.pl changes for delete_folder restrictions with Courier-IMAP and UW-IMAP (#715550). - Fixed code to allow for \ in password/username (#718116). + - Added mailto: support for Windows clients. See + contrib/squirrelmail.mailto.reg ************************************** diff --git a/contrib/squirrelmail.mailto.reg b/contrib/squirrelmail.mailto.reg new file mode 100644 index 00000000..907a5284 --- /dev/null +++ b/contrib/squirrelmail.mailto.reg @@ -0,0 +1,28 @@ +Here is a windows registry file to set SquirrelMail as a windows email program +Once this entry is installed, go to Internet Options and select the Programs +tab. SquirrelMail should be an option under E-mail: + +---- Cut here ---- +Windows Registry Editor Version 5.00 + +[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\SquirrelMail] +@="SquirrelMail" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\SquirrelMail\Protocols] + +[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\SquirrelMail\Protocols\mailto] +"URL Protocol"="" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\SquirrelMail\Protocols\mailto\shell] + +[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\SquirrelMail\Protocols\mailto\shell\open] + +[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\SquirrelMail\Protocols\mailto\shell\open\command] +@="rundll32.exe url.dll,FileProtocolHandler http://mail.server/squirrelmail/src/mailto.php?emailaddress=\"%1\"" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\SquirrelMail\shell] + +[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\SquirrelMail\shell\open] + +[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\SquirrelMail\shell\open\command] + diff --git a/src/login.php b/src/login.php index 9b0dced9..4c4c41c3 100644 --- a/src/login.php +++ b/src/login.php @@ -95,6 +95,11 @@ if (isset($org_logo) && $org_logo) { } } +if(sqgetGlobalVar('mailto', $mailto)) { + $rcptaddress = '' . "\n"; +} else { + $rcptaddress = ''; +} echo html_tag( 'table', html_tag( 'tr', html_tag( 'td', @@ -131,6 +136,7 @@ echo html_tag( 'table', html_tag( 'td', '' . "\n" . '' . "\n" . + $rcptaddress . '' . "\n", 'left', '', 'width="*"' ) ) , diff --git a/src/mailto.php b/src/mailto.php new file mode 100644 index 00000000..9f0603cf --- /dev/null +++ b/src/mailto.php @@ -0,0 +1,72 @@ +//src/mailto.php?emailaddress="%1" + * see ../contrib/squirrelmail.mailto.reg for a Windows Registry file + */ + +/* Path for SquirrelMail required files. */ +define('SM_PATH','../'); + +/* SquirrelMail required files. */ +require_once(SM_PATH . 'config/config.php'); +require_once(SM_PATH . 'functions/global.php'); + +header('Pragma: no-cache'); +if(!sqgetGlobalVar('emailaddress', $emailaddress)) { + return; +} + +if(stristr($emailaddress, 'mailto:')) { + $emailaddress = substr($emailaddress, 7); +} +if(($pos = strpos($emailaddress, '?')) !== false) { + $a = substr($emailaddress, $pos+1); + list($emailaddress, $a) = explode('?', $emailaddress, 2); + $a = explode('=', $a, 2); + $_GET['emailaddress'] = $emailaddress; + $_GET[$a[0]] = $a[1]; +} + +$trtable = array('emailaddress' => 'send_to', + 'cc' => 'send_to_cc', + 'bcc' => 'send_to_bcc', + 'body' => 'body', + 'subject' => 'subject'); +$url = ''; +/* CC, BCC, etc could be any case, so we'll fix them here */ +foreach($_GET as $k=>$g) { + if($g != '') { + $k = strtolower($k); + $k = $trtable[$k]; + $url .= $k . '=' . urlencode($g) . '&'; + } +} +$url = substr($url, 0, -1); + +sqsession_is_active(); +/* Check to see if we're logged in */ +/* +if (sqsession_is_registered('user_is_logged_in')) { + $redirect = 'webmail.php?right_frame=compose.php?'; +} else { + $redirect = 'login.php?mailto='; +} +*/ +$url = urlencode($url); +/* $redirect .= $url; */ +$redirect = 'login.php?mailto=' . $url; +session_write_close(); +header('Location: ' . $redirect); +?> diff --git a/src/redirect.php b/src/redirect.php index 89529f11..5658995d 100644 --- a/src/redirect.php +++ b/src/redirect.php @@ -49,6 +49,9 @@ sqGetGlobalVar('js_autodetect_results', $js_autodetect_results); if(!sqGetGlobalVar('squirrelmail_language', $squirrelmail_language) || $squirrelmail_language == '') { $squirrelmail_language = $squirrelmail_default_language; } +if (!sqgetGlobalVar('mailto', $mailto)) { + $mailto = ''; +} /* end of get globals */ @@ -147,6 +150,10 @@ if ( sqgetGlobalVar('session_expired_location', $session_expired_location, SQ_SE } unset($session_expired_location); } +if($mailto != '') { + $redirect_url = 'webmail.php?right_frame=compose.php&mailto='; + $redirect_url .= $mailto; +} /* Write session data and send them off to the appropriate page. */ session_write_close(); diff --git a/src/webmail.php b/src/webmail.php index 0df533a3..ac2bac75 100644 --- a/src/webmail.php +++ b/src/webmail.php @@ -42,6 +42,9 @@ sqgetGlobalVar('right_frame', $right_frame, SQ_GET); if ( isset($_SESSION['session_expired_post']) ) { sqsession_unregister('session_expired_post'); } +if(!sqgetGlobalVar('mailto', $mailto)) { + $mailto = ''; +} is_logged_in(); @@ -120,6 +123,8 @@ if ($right_frame == 'right_main.php') { $right_frame_url = 'options.php'; } elseif ($right_frame == 'folders.php') { $right_frame_url = 'folders.php'; +} elseif ($right_frame == 'compose.php') { + $right_frame_url = 'compose.php?' . $mailto; } else if ($right_frame == '') { $right_frame_url = 'right_main.php'; } else {