The error:
In the /admin/settings/smtp, if the SMTP server field has spaces before of after the value, the SMTP module will be unable to connect, throwing the following error:

SMTP -> ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0)
SMTP Error: Could not connect to SMTP host.

The (temporary) solution
The error is easily solved: simply remove any whitespace in the field, and things work fine.

I'm not sure if the other fields suffer from the same problem.

I guess a simple trim() would fix things, but don't know where that should be.

CommentFileSizeAuthor
#2 468568-trim.patch547 bytesSimon Georges
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

oadaeh’s picture

Assigned: Unassigned » oadaeh

Thanks for the update. Probably the port number could benefit from a trim() function, as well. I'll include the fix in the near future, but for those playing at home, I changed this:

  $mail->Host   = variable_get('smtp_host', '') .';'. variable_get('smtp_hostbackup', '');
  $mail->Port   = variable_get('smtp_port', '25');

to this:

  $mail->Host   = trim(variable_get('smtp_host', '')) .';'. trim(variable_get('smtp_hostbackup', ''));
  $mail->Port   = trim(variable_get('smtp_port', '25'));

at around line 758 of smtp.module.

Simon Georges’s picture

Status: Active » Needs review
FileSize
547 bytes

Patch provided implementing the suggestion above.

Regards,

wundo’s picture

Issue summary: View changes
Status: Needs review » Closed (works as designed)

Closing very old (dead) issues, if you think this is still relevant please re-open.