How can I remove the remains of the Mass Contact module not properly uninstalled?
This is an issue already resolved for the 8.x-1.x branch, as reported in Uninstall should remove mass_contact_opt_out field.

The code that has been added to the uninstall hook is the following one.

Drupal::configFactory()-&gt;getEditable('field.field.user.user.mass_contact_opt_out')-&gt;delete();
Drupal::configFactory()-&gt;getEditable('field.storage.user.mass_contact_opt_out')-&gt;delete();


If you have Drush installed, you can write those two lines in a file (for example, fix-module.php) and run it with drush php-script fix.module.php. You can also put the following code in a file next to the authorize.php file that comes with Drupal core, and access that file from the browser.

use Drupal\Core\DrupalKernel;
use Drupal\Core\Config\ConfigFactoryInterface;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

// Change the directory to the Drupal root.
chdir('..');
$autoloader = (require_once 'autoload.php');

try {
  $request = Request::createFromGlobals();
  $kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod');
  $kernel-&gt;boot();
  Drupal::configFactory()-&gt;getEditable('field.field.user.user.mass_contact_opt_out')-&gt;delete();
    Drupal::configFactory()-&gt;getEditable('field.storage.user.mass_contact_opt_out')-&gt;delete();
} catch (HttpExceptionInterface $e) {
  $response = new Response('', $e-&gt;getStatusCode());
  $response-&gt;prepare($request)-&gt;send();
  exit;
}