diff -bBdNrw -U5 squirrelmail-1.4.3/config/config_default.php squirrelmail-1.4.3.otp/config/config_default.php
--- squirrelmail-1.4.3/config/config_default.php	2004-04-21 19:21:54.000000000 +0200
+++ squirrelmail-1.4.3.otp/config/config_default.php	2004-06-01 00:50:37.000000000 +0200
@@ -232,10 +232,17 @@
  * @global string $imap_auth_mech
  */
 $imap_auth_mech = 'login';
 
 /**
+ * 'true' if you use IMAP OTP Wrapper
+ * This will close the persistent connection with server on logout.
+ *
+ */
+$imap_otp_wrapper = 'true';
+
+/**
  * IMAP folder delimiter
  *
  * This is the delimiter that your IMAP server uses to distinguish between
  * folders.  For example, Cyrus uses '.' as the delimiter and a complete
  * folder would look like 'INBOX.Friends.Bob', while UW uses '/' and would
diff -bBdNrw -U5 squirrelmail-1.4.3/functions/imap_general.php squirrelmail-1.4.3.otp/functions/imap_general.php
--- squirrelmail-1.4.3/functions/imap_general.php	2004-05-02 15:54:36.000000000 +0200
+++ squirrelmail-1.4.3.otp/functions/imap_general.php	2004-06-01 00:51:23.000000000 +0200
@@ -565,10 +565,19 @@
      * If we don't have an imap_ stream we're already logged out */
     if(isset($imap_stream) && $imap_stream)
         sqimap_run_command($imap_stream, 'LOGOUT', false, $response, $message);
 }
 
+/* Simply logs out the IMAP session (when use OTP wrapper) */
+function sqimap_otp_logout ($imap_stream) {
+  global $imap_otp_wrapper;
+    /* Logout is not valid until the server returns 'BYE'
+     * If we don't have an imap_ stream we're already logged out */
+    if(isset($imap_stream) && $imap_stream && $imap_otp_wrapper == 'true')
+      sqimap_run_command($imap_stream, 'OTP-LOGOUT', false, $response, $message);
+}
+
 function sqimap_capability($imap_stream, $capability='') {
     global $sqimap_capabilities;
     if (!is_array($sqimap_capabilities)) {
         $read = sqimap_run_command($imap_stream, 'CAPABILITY', true, $a, $b);
 
diff -bBdNrw -U5 squirrelmail-1.4.3/src/signout.php squirrelmail-1.4.3.otp/src/signout.php
--- squirrelmail-1.4.3/src/signout.php	2004-02-24 16:57:39.000000000 +0100
+++ squirrelmail-1.4.3.otp/src/signout.php	2004-06-01 00:51:47.000000000 +0200
@@ -14,15 +14,27 @@
 /* Path for SquirrelMail required files. */
 define('SM_PATH','../');
 
 /* SquirrelMail required files. */
 require_once(SM_PATH . 'include/validate.php');
+require_once(SM_PATH . 'functions/global.php');
+require_once(SM_PATH . 'functions/imap.php');
 require_once(SM_PATH . 'functions/prefs.php');
 require_once(SM_PATH . 'functions/plugin.php');
 require_once(SM_PATH . 'functions/strings.php');
 require_once(SM_PATH . 'functions/html.php');
 
+/* lets get the global vars we may need */
+sqgetGlobalVar('key',       $key,           SQ_COOKIE);
+sqgetGlobalVar('username',  $username,      SQ_SESSION);
+
+if ($imap_otp_wrapper == 'true')
+{
+  $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+  sqimap_otp_logout($imapConnection);
+}
+
 /* Erase any lingering attachments */
 if (isset($attachments) && is_array($attachments) 
     && sizeof($attachments)){
     $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
     foreach ($attachments as $info) {
