-/* CC, BCC, etc could be any case, so we'll fix them here */
-foreach($_GET as $k=>$g) {
- if($g != '') {
+
+$data = array();
+
+if(sqgetGlobalVar('emailaddress', $emailaddress)) {
+ $emailaddress = trim($emailaddress);
+ if(stristr($emailaddress, 'mailto:')) {
+ $emailaddress = substr($emailaddress, 7);
+ }
+ if(strpos($emailaddress, '?') !== false) {
+ list($emailaddress, $a) = explode('?', $emailaddress, 2);
+ if(strlen(trim($a)) > 0) {
+ $a = explode('=', $a, 2);
+ $data[strtolower($a[0])] = $a[1];
+ }
+ }
+ $data['to'] = $emailaddress;
+
+ /* CC, BCC, etc could be any case, so we'll fix them here */
+ foreach($_GET as $k=>$g) {