Skip to content

[4.0] SMTP connection fails without SSL/TLS #24241

@joeforjoomla

Description

@joeforjoomla

Related PR #23591

Steps to reproduce the issue

Try to connect to an SMTP server without any SSL/TLS security option turned on

image

Expected result

Connection is successful as in Joomla 3.9

Actual result

Connection fails and doesn't fallback anymore to a new one without a secutiry layer
It's not possible to connect to SMTP server without any SSL/TLS because $SMTPAutoTLS in the PHPMailer class is always true and not managed in any way by the mail class or Joomla options.

Additionally, even SSL/TLS options fail to connect to the SMTP server if enabled.

System information (as much as possible)

Joomla 4.0 Alpha 8

Additional comments

This is the result to have removed the following code in the Mail class within the Send function:

try
{
// Try sending with default settings
$result = parent::send();
}
catch (\phpmailerException $e)
{
$result = false;

if ($this->SMTPAutoTLS)
{
	/**
	 * PHPMailer has an issue with servers with invalid certificates
	 *
	 * See: https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting#opportunistic-tls
	 */
	$this->SMTPAutoTLS = false;

	try
	{
		// Try it again with TLS turned off
		$result = parent::send();
	}
	catch (\phpmailerException $e)
	{
		// Keep false for B/C compatibility
		$result = false;
	}
}
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions