Skip to content

Commit f463099

Browse files
Merge pull request #4 from die-wegmeister/fix/dsn-migration
BUGFIX: URL encode username, password and host in MailerService::createDsnFromSMTPSwiftMailerConfiguration()
2 parents 69a2ade + 18f87ac commit f463099

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Classes/Service/MailerService.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Neos\SymfonyMailer\Service;
@@ -78,7 +79,7 @@ public function getMailer(TransportInterface $transport = null): Mailer
7879
public function createDsnFromSMTPSwiftMailerConfiguration(array $configuration): string
7980
{
8081
$transport = new EsmtpTransport(
81-
host: $configuration['host'] ?? 'localhost',
82+
host: urlencode($configuration['host'] ?? 'localhost'),
8283
port: (int)($configuration['port'] ?? 0)
8384
);
8485

@@ -87,11 +88,11 @@ public function createDsnFromSMTPSwiftMailerConfiguration(array $configuration):
8788
}
8889

8990
if (isset($configuration['username'])) {
90-
$transport->setUsername($configuration['username']);
91+
$transport->setUsername(urlencode($configuration['username']));
9192
}
9293

9394
if (isset($configuration['password'])) {
94-
$transport->setPassword($configuration['password']);
95+
$transport->setPassword(urlencode($configuration['password']));
9596
}
9697

9798
$dsn = new Transport\Dsn(

0 commit comments

Comments
 (0)