diff --git a/zerver/lib/import_realm.py b/zerver/lib/import_realm.py index 4b1fdfcfca..a18a2896ed 100644 --- a/zerver/lib/import_realm.py +++ b/zerver/lib/import_realm.py @@ -718,6 +718,10 @@ def do_import_realm(import_dir: Path, subdomain: str) -> Realm: # Remap the user IDs for notification_bot and friends to their # appropriate IDs on this server for item in data['zerver_userprofile_crossrealm']: + if item['email'].startswith("emailgateway@"): + # The email gateway bot's email is customized to a + # different domain on some servers. + item['email'] = settings.EMAIL_GATEWAY_BOT logging.info("Adding to ID map: %s %s" % (item['id'], get_system_bot(item['email']).id)) new_user_id = get_system_bot(item['email']).id update_id_map(table='user_profile', old_id=item['id'], new_id=new_user_id)