Browse Source

* Added much better support for the mailto stuff

Tyler Akins 24 years ago
parent
commit
e63baae76c
2 changed files with 35 additions and 1 deletions
  1. 33 0
      src/login.php
  2. 2 1
      src/redirect.php

+ 33 - 0
src/login.php

@@ -17,6 +17,39 @@
          $rcptaddress = substr($emailaddress, 7);
       else
          $rcptaddress = $emailaddress;
+	 
+      if (($pos = strpos($rcptaddress, '?')) !== false)
+      {
+         $a = substr($rcptaddress, $pos + 1);
+	 $rcptaddress = substr($rcptaddress, 0, $pos);
+	 $a = explode('=', $a, 2);
+	 if (isset($a[1])) {
+	    $name = urldecode($a[0]);
+	    $val = urldecode($a[1]);
+	    global $$name;
+	    $$name = $val;
+	 }
+      }
+      
+      // At this point, we have parsed a lot of the mailto stuff.  Let's
+      // do the rest -- CC, BCC, Subject, Body
+      // Note:  They can all be case insensitive
+      foreach ($GLOBALS as $k => $v)
+      {
+          $key = strtolower($k);
+	  $value = urlencode($v);
+	  if ($key == 'cc')
+	     $rcptaddress .= '&send_to_cc=' . $value;
+	  elseif ($key == 'bcc')
+	     $rcptaddress .= '&send_to_bcc=' . $value;
+	  elseif ($key == 'subject')
+	     $rcptaddress .= '&subject=' . $value;
+	  elseif ($key == 'body')
+	     $rcptaddress .= '&body=' . $value;
+      }
+      
+      // Double-encode in this fashion to get past redirect.php properly
+      $rcptaddress = urlencode($rcptaddress);
    }
 
    include("../functions/strings.php");

+ 2 - 1
src/redirect.php

@@ -92,7 +92,8 @@
    session_register ('just_logged_in');
 
    if(isset($rcptemail))
-      header("Location: webmail.php?right_frame=compose.php&rcptaddress=$rcptemail");
+      header("Location: webmail.php?right_frame=compose.php&rcptaddress=" .
+         urlencode($rcptemail));
    else
       header("Location: webmail.php");
 ?>