Many of us put all contributed modules in a contrib subdirectory for the case we would want to upgrade. I did, and when I activated the module and enabled it in administer >> settings >> smtp, it gave me a "Can't find module" error (which was not only shown to me as the admin, but also to registered and anonymous users) in every page of my site. I did a fast researching and the problem is this line:

if (variable_get('smtp_on', 1)) {
  if (is_file(getcwd() . '/' . 'modules/smtp.module')) {
    variable_set('smtp_library', 'modules/smtp.module');
  }elseif (is_file(getcwd() . '/' . 'modules/smtp/smtp.module')) {
    variable_set('smtp_library', 'modules/smtp/smtp.module');
  } else {
    drupal_set_message(t("Can't find module"), 'error');
  }

Obviously, the easiest fix is to put the module in the 'modules' folder. But if you take have loads of contrib modules like me and want to put everything where it belongs, then this fix will do:

if (variable_get('smtp_on', 1)) {
  if (is_file(getcwd() . '/' . 'modules/smtp.module')) {
    variable_set('smtp_library', 'modules/smtp.module');
  }elseif (is_file(getcwd() . '/' . 'modules/smtp/smtp.module')) {
    variable_set('smtp_library', 'modules/smtp/smtp.module');
  }elseif (is_file(getcwd() . '/' . 'modules/contrib/smtp.module')) {
    variable_set('smtp_library', 'modules/contrib/smtp.module');
  } else {
    drupal_set_message(t("Can't find module"), 'error');
  }

Comments

LukeLast’s picture

Assigned: Unassigned » LukeLast
Status: Needs review » Fixed

This problem should be totally fixed in the latest version.

Anonymous’s picture

Status: Fixed » Closed (fixed)