The missing phpmailer module I updated a site with "Composer update --with-dependencies"
and encountered the following problem:

User warning: The following module is missing from the file system: phpmailer in drupal_get_filename()


Then I ran: composer require drupal/phpmailer.

Terminal returned:

Using version ^3.0@beta for drupal/phpmailer
./composer.json has been updated


And

Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files


But the Status Report still showed that phpmailer module was missing.

So I attempted running "drush en phpmailer -y"

And it returned:

phpmailer was not found.                                             [warning]
The following projects provide some or all of the extensions not     [ok]
found:
phpmailer
Would you like to download them? (y/n): y
This codebase is assembled with Composer instead of Drush. Use       [error]
`composer update` and `composer require` instead of `drush
pm-updatecode` and `drush pm-download`. You may override this error
by using the --pm-force option.
phpmailer was not found.                                             [warning]
Unable to download some or all of the extensions.                    [warning]
There were no extensions that could be enabled.                      [ok]


What can I do to fix this?
There is a module for that: https://www.drupal.org/project/module_missing_message_fixer

And you can try drush or devel according to the doc here https://www.drupal.org/node/2487215

Use Drush

drush sql-query "DELETE FROM key_value WHERE collection='system.schema' AND name='module_name';"


When done, clear the site's caches (e.g. drush cr).
Also make sure that the CMI folder is cleansed of the broken uninstalled module. There may be some yml files left over and / or some system config. (this is all not the best way to do things as a FYI. However with Drupal 8 being so young, things don't go as planned always).

Use Devel

Enable Devel module and go to /devel/php. This will allow you to run some PHP code and you can execute the following:

$query = \Drupal::database()-&gt;delete('key_value')
    -&gt;condition('collection', 'system.schema')
    -&gt;condition('name', 'module_name')
    -&gt;execute();