66
77use Exception ;
88use PhpList \Core \Domain \Messaging \Service \EmailService ;
9+ use Symfony \Component \Console \Attribute \AsCommand ;
910use Symfony \Component \Console \Command \Command ;
1011use Symfony \Component \Console \Input \InputArgument ;
1112use Symfony \Component \Console \Input \InputInterface ;
1213use Symfony \Component \Console \Output \OutputInterface ;
1314use Symfony \Component \Mime \Address ;
1415use Symfony \Component \Mime \Email ;
1516
17+ #[AsCommand(
18+ name: 'phplist:test-email ' ,
19+ description: 'Send a test email to verify email configuration '
20+ )]
1621class SendTestEmailCommand extends Command
1722{
18- protected static $ defaultName = 'phplist:test-email ' ;
19- protected static $ defaultDescription = 'Send a test email to verify email configuration ' ;
20-
2123 private EmailService $ emailService ;
2224
2325 public function __construct (EmailService $ emailService )
@@ -29,9 +31,17 @@ public function __construct(EmailService $emailService)
2931 protected function configure (): void
3032 {
3133 $ this
32- ->setDescription (self ::$ defaultDescription )
33- ->addArgument ('recipient ' , InputArgument::OPTIONAL , 'Recipient email address ' )
34- ->addOption ('sync ' , null , InputArgument::OPTIONAL , 'Send email synchronously instead of queuing it ' , false );
34+ ->addArgument (
35+ name: 'recipient ' ,
36+ mode: InputArgument::OPTIONAL ,
37+ description: 'Recipient email address '
38+ )
39+ ->addOption (
40+ name: 'sync ' ,
41+ mode: InputArgument::OPTIONAL ,
42+ description: 'Send email synchronously instead of queuing it ' ,
43+ default: false
44+ );
3545 }
3646
3747 protected function execute (InputInterface $ input , OutputInterface $ output ): int
0 commit comments