Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/Illuminate/Mail/MailManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,7 @@ protected function createSmtpTransport(array $config)
$scheme = $config['scheme'] ?? null;

if (! $scheme) {
$scheme = ! empty($config['encryption']) && $config['encryption'] === 'tls'
? (($config['port'] == 465) ? 'smtps' : 'smtp')
: '';
$scheme = ($config['port'] == 465) ? 'smtps' : 'smtp';
}

$transport = $factory->create(new Dsn(
Expand Down
6 changes: 5 additions & 1 deletion tests/Mail/MailManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use InvalidArgumentException;
use Orchestra\Testbench\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\TestWith;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;

class MailManagerTest extends TestCase
Expand All @@ -27,9 +28,12 @@ public function testEmptyTransportConfig($transport)
$this->app['mail.manager']->mailer('custom_smtp');
}

public function testMailUrlConfig()
#[TestWith(['smtp'])]
#[TestWith(['smtps'])]
public function testMailUrlConfig($scheme)
{
$this->app['config']->set('mail.mailers.smtp_url', [
'scheme' => $scheme,
'url' => 'smtp://usr:pwd@127.0.0.2:5876',
]);

Expand Down