File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
src/Codeception/Lib/Connector Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -308,7 +308,11 @@ public function startApp(?\yii\log\Logger $logger = null): void
308308
309309 match ($ this ->mailMethod ) {
310310 self ::MAIL_CATCH => $ config = $ this ->mockMailer ($ config ),
311- self ::MAIL_EVENT_AFTER => $ config ['components ' ]['mailer ' ]['on ' . BaseMailer::EVENT_AFTER_SEND ] = fn (MailEvent $ event ) => $ this ->emails [] = $ event ->message ,
311+ self ::MAIL_EVENT_AFTER => $ config ['components ' ]['mailer ' ]['on ' . BaseMailer::EVENT_AFTER_SEND ] = function (MailEvent $ event ): void {
312+ if ($ event ->isSuccessful ) {
313+ $ this ->emails [] = $ event ->message ;
314+ }
315+ },
312316 self ::MAIL_EVENT_BEFORE => $ config ['components ' ]['mailer ' ]['on ' . BaseMailer::EVENT_BEFORE_SEND ] = fn (MailEvent $ event ) => $ this ->emails [] = $ event ->message ,
313317 self ::MAIL_IGNORE => null // Do nothing
314318 };
You can’t perform that action at this time.
0 commit comments