diff --git a/extensions/swiftmailer/Mailer.php b/extensions/swiftmailer/Mailer.php index 58f0f23..c00fad6 100644 --- a/extensions/swiftmailer/Mailer.php +++ b/extensions/swiftmailer/Mailer.php @@ -145,7 +145,7 @@ class Mailer extends BaseMailer $transport->$name = $value; } else { $setter = 'set' . $name; - if (method_exists($transport, $setter)) { + if (method_exists($transport, $setter) || method_exists($transport, '__call')) { $transport->$setter($value); } else { throw new InvalidConfigException('Setting unknown property: ' . get_class($transport) . '::' . $name); diff --git a/tests/unit/extensions/swiftmailer/MailerTest.php b/tests/unit/extensions/swiftmailer/MailerTest.php index 306e128..24602b2 100644 --- a/tests/unit/extensions/swiftmailer/MailerTest.php +++ b/tests/unit/extensions/swiftmailer/MailerTest.php @@ -53,6 +53,8 @@ class MailerTest extends VendorTestCase $transportConfig = [ 'class' => 'Swift_SmtpTransport', 'host' => 'localhost', + 'username' => 'username', + 'password' => 'password', ]; $mailer->setTransport($transportConfig); $transport = $mailer->getTransport();