【发布时间】:2012-07-09 10:56:02
【问题描述】:
我在我的 Symfony 应用程序中创建了一个新命令。
在此命令中,我调用了一个服务,该服务发送电子邮件 作为 FOS 包中的邮件程序。
我的问题是 电子邮件正文显示到控制台以发送电子邮件。
我想说msg mailer 方法在命令之外可以正常工作。
这是我的命令:
class ReminderCommand extends Command
{
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->container = $this->getApplication()->getKernel()->getContainer();
# the mailer service works fine out the command
$mailer = $this->container->get('mailer');
$mailer->sendMsg(...);
$text = ' => mail sent';
$output->writeln($text);
}
}
请帮忙
谢谢
山姆
【问题讨论】:
标签: symfony swiftmailer