Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MailerTestCommand.php

function MailerTestCommand::execute

Overrides Command::execute

File

vendor/symfony/mailer/Command/MailerTestCommand.php, line 57

Class

MailerTestCommand
A console command to test Mailer transports.

Namespace

Symfony\Component\Mailer\Command

Code

protected function execute(InputInterface $input, OutputInterface $output) : int {
    $message = (new Email())->to($input->getArgument('to'))
        ->from($input->getOption('from'))
        ->subject($input->getOption('subject'))
        ->text($input->getOption('body'));
    if ($transport = $input->getOption('transport')) {
        $message->getHeaders()
            ->addTextHeader('X-Transport', $transport);
    }
    $this->transport
        ->send($message);
    return 0;
}
RSS feed
Powered by Drupal