Skip to content

Commit

Permalink
Fix SMTP authentication not working in some cases due to setAuthMode(…
Browse files Browse the repository at this point in the history
…) used in Swiftmailer - closes #4250
  • Loading branch information
freescout-help-desk committed Oct 2, 2024
1 parent b92e502 commit 0280e4f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions config/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,12 @@
| Auth mode
|--------------------------------------------------------------------------
|
| 'login' or 'XOAUTH2'
| This option have an effect when set to 'XOAUTH2' only.
| In other cases Swiftmailer chooses auth mode automatically.
|
*/

'auth_mode' => env('MAIL_AUTH_MODE', 'login'),
'auth_mode' => env('MAIL_AUTH_MODE', ''),

/*
|--------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Swift_SmtpTransport extends Swift_Transport_EsmtpTransport
* @param int $port
* @param string $encryption
*/
public function __construct($host = 'localhost', $port = 25, $encryption = null, $auth_mode = 'login')
public function __construct($host = 'localhost', $port = 25, $encryption = null, $auth_mode = '')
{
parent::__construct(...Swift_DependencyContainer::getInstance()->createDependenciesFor('transport.smtp'));
// call_user_func_array(
Expand All @@ -39,6 +39,8 @@ public function __construct($host = 'localhost', $port = 25, $encryption = null,
$this->setHost($host);
$this->setPort($port);
$this->setEncryption($encryption);
$this->setAuthMode($auth_mode);
if ($auth_mode == 'XOAUTH2') {
$this->setAuthMode($auth_mode);
}
}
}

0 comments on commit 0280e4f

Please sign in to comment.