Thursday 3 December 2015

PHP 5.3, Drupal 6, SMTP Authentication, AWS and 'Could not connect to SMTP host.'

I haven't got to the bottom of exactly why this is happening, but if you're trying to get the following combination working


  • Drupal 6
  • SMTP Authentication 6.x.1.1 with PHPmailer
  • PHP 5.3

and you get the error 'Could not connect to SMTP host', you can fix it as follows:


 // Set other connection settings. // LINE 785
  $mail->Host   = variable_get('smtp_host', '') .';'. variable_get('smtp_hostbackup', '');
  $mail->Port   = variable_get('smtp_port', '25');
  $mail->Mailer = 'smtp'; // COMMENT OUT THIS LINE 

I suspect from the debug with the $mail->Mailer='smtp' flag it is sending smtp commands in clear, not starting tls.