Index: squirrelmail_usercopy.php
===================================================================
--- squirrelmail_usercopy.php	(revision 4614)
+++ squirrelmail_usercopy.php	(working copy)
@@ -67,17 +67,35 @@
 				}
 			}
 
-			// copy address book
+			// Copy in contacts
 			$contacts = $rcmail->get_address_book(null, true);
 			if ($contacts && count($this->abook)) {
 				foreach ($this->abook as $rec) {
-				    // #1487096 handle multi-address and/or too long items
-				    $rec['email'] = array_shift(explode(';', $rec['email']));
-                    if (check_email(rcube_idn_to_ascii($rec['email']))) {
-                        $rec['email'] = rcube_idn_to_utf8($rec['email']);
-    					$contacts->insert($rec, true);
-			        }
-			    }
+					// Check if this contact has multiple email addresses or only one
+					if((strpos($rec['email'], ";") === false) && (strpos($rec['email'], ",") === false)) {
+						// single contact
+
+						if(check_email(idn_to_ascii($rec['email']))) {
+							// email is valid and under 128 chars
+							$rec['email'] = idn_to_utf8($rec['email']);
+							$contacts->insert($rec, true);
+						}
+					} else {
+						// multiple contact
+						
+						// create group for addresses
+						$newGroup = $contacts->create_group($rec['name']);
+						$groupId = $newGroup['id'];
+						
+						// create contacts for each email and add them to group
+						$groupInsertEmails = preg_split("/[;,]/", $rec['email']);
+						foreach($groupInsertEmails as $thisEmail) {
+							$thisContact['email'] = idn_to_utf8($thisEmail);
+							$groupInsertUser = $contacts->insert($thisContact, true);
+							$contacts->add_to_group($groupId, array($groupInsertUser));
+						}
+					}
+				}
 			}
 
 			// mark identity as complete for following hooks
