From b27fd086ff771b4514ada31cdef7d36433e948f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Thu, 23 Jan 2025 17:42:00 +0100 Subject: [PATCH] feat: add command to test smtp transport --- src/Command/MailTestCommand.php | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/Command/MailTestCommand.php diff --git a/src/Command/MailTestCommand.php b/src/Command/MailTestCommand.php new file mode 100644 index 0000000..63bd2e4 --- /dev/null +++ b/src/Command/MailTestCommand.php @@ -0,0 +1,43 @@ +addArgument('to', InputArgument::REQUIRED, 'Recipient email') + ->addArgument('from', InputArgument::OPTIONAL, 'Sender email', 'team@ep-reisen.de') + ; + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $email = (new Email()) + ->to($input->getArgument('to')) + ->from($input->getArgument('from')) + ->subject('Testing SMTP Transport') + ->text('Testing SMTP Transport'); + + $this->mailer->send($email); + + return Command::SUCCESS; + } +}