diff --git a/CHANGELOG.md b/CHANGELOG.md index 60922af1c..d4854c5dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ - Password: Verify current password with IMAP (#8142) - Password: Improve handling errors on executed commands (#8200) - Fix locked SQLite database for the CLI tools (#8035) +- Fix importing contacts with no email address (#8227) ## Release 1.5.0 diff --git a/program/actions/contacts/import.php b/program/actions/contacts/import.php index 311025f3e..c8784dde1 100644 --- a/program/actions/contacts/import.php +++ b/program/actions/contacts/import.php @@ -196,8 +196,11 @@ class rcmail_action_contacts_import extends rcmail_action_contacts_index } // We're using UTF8 internally - $email = $vcard->email[0]; - $email = rcube_utils::idn_to_utf8($email); + $email = null; + if (isset($vcard->email[0])) { + $email = $vcard->email[0]; + $email = rcube_utils::idn_to_utf8($email); + } if (!$replace) { $existing = null; diff --git a/program/lib/Roundcube/rcube_contacts.php b/program/lib/Roundcube/rcube_contacts.php index 307f5359b..3f3bfda7d 100644 --- a/program/lib/Roundcube/rcube_contacts.php +++ b/program/lib/Roundcube/rcube_contacts.php @@ -809,6 +809,8 @@ class rcube_contacts extends rcube_addressbook // save all e-mails in the database column if (!empty($vcard->email)) { $out['email'] = implode(self::SEPARATOR, $vcard->email); + } else { + $out['email'] = isset($save_data['email']) ? $save_data['email'] : ''; } // join words for fulltext search