Beta 1 and 2 are fine, but after updating to Beta 3, emails won't send anymore with Can't connect to server errors. Sample debug info attached

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kruser created an issue. See original summary.

oadaeh’s picture

Category: Bug report » Support request
Status: Active » Postponed (maintainer needs more info)

Sorry for not responding sooner.
I don't know if this is still a problem, but here are my observations:

  • The differences between beta2 abd beta3 should not affect normal operations, since it was only updating a composer.json file: https://www.drupal.org/project/phpmailer/releases/7.x-3.0-beta3
  • The provided debug file seems to have binary characters at the point where the error message is, so I cannot see what the server reported the problem as.
  • Based on what I can see in the debug file, it looks like it might possibly have timed out.

Let me know if this is still a problem for you or not, and if so, please try to provide the actual message in plain text, so that I can see what it says.
Thank you.

Proteo’s picture

Hi there. Sorry for hijacking this issue, I'm having a similar problem and even if after reading the debug messages in the above post I realize the source of the issue I'm facing is not exactly the same, I wanted to share my findings.

I'm having an "SMTP Authentication failed" message every single time I try to send emails, when obviously all the SMTP settings (including username and password) are correct. After checking the debug messages, there's always an error SMTP ERROR Username command failed: 535 5.7.8 at the end of the logs.

A quick search revealed a possible solution here and here, by adding $mail->AuthType = 'LOGIN'; when configuring the PHPMailer class.

So I did a quick test adding $this->AuthType = 'LOGIN'; to the line #76 in phpmailer/includes/phpmailer.class.inc and voilà, everything is now working flawlessly.

From what I read in the linked posts, it seems necessary to set the AuthType property whe using versions >= 5.2.25 of the PHPMailer library, so you may want to take a look at it.

oadaeh’s picture

Title: Emails won't send » Implement SMTP authentication type
Version: 7.x-3.0-beta3 » 7.x-3.x-dev
Assigned: Unassigned » oadaeh
Category: Support request » Feature request
Priority: Major » Normal
Status: Postponed (maintainer needs more info) » Active

Thank you for the information @Proteo. It is curious to me why that was not included already, but it may be because the PHPMailer library does a descent job of guessing it, that it wasn't needed for most situations.

oadaeh’s picture

Assigned: oadaeh » Unassigned
Status: Active » Needs review
FileSize
2.53 KB

Attached is a patch that addresses the issue.
@Proteo, if you can test it and let me know if it still works for you, that would be great.

Proteo’s picture

FileSize
875 bytes

Hi @oadaeh, unfortunately the patch won't apply cleanly to 7.x-3.0-beta4:
I'm attaching the phpmailer.class.inc.rej file. Many thanks for your support, please let me know if I can help further.

Sorry, my bad! It's too early in the morning :) I was trying to apply your patch over my modified version :| After cleaning up my own changes, the patch worked perfectly. And after choosing "LOGIN" as authentication type in the new options select I can send emails without problem.

Proteo’s picture

Status: Needs review » Reviewed & tested by the community

  • oadaeh committed d39cf0b on 7.x-3.x
    Issue #2898845 by oadaeh, Proteo: Implement SMTP authentication type
    
oadaeh’s picture

Status: Reviewed & tested by the community » Fixed

This has been committed to the dev branch. I will be committing #2947486: Clean up code and then creating 7.x-3.0-rc1.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.