Skip to content

Commit 6ac4ca2

Browse files
authored
Update Mailer.php (#1039)
username and password must be urlencoded for propper smtp service (otherwise it wont work with some special characters)
1 parent 74602b0 commit 6ac4ca2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

web/includes/Mail/Mailer.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ public function send(array|string $destination,
5252
?array $files = null
5353
): bool
5454
{
55-
$dsn = "smtp://$this->user:$this->password@$this->host";
55+
$encodedUser = urlencode($this->user);
56+
$encodedPassword = urlencode($this->password);
57+
$dsn = "smtp://$encodedUser:$encodedPassword@$this->host:$this->port";
5658

5759
if ($this->port != null)
5860
$dsn .= ":$this->port";
@@ -99,4 +101,4 @@ public static function create(): ?Mailer
99101

100102
return new Mailer($config[0], $config[1], $config[2], $from, $port, $verifyPeer);
101103
}
102-
}
104+
}

0 commit comments

Comments
 (0)