如何从Symfony2中的“\ Swift_Events_SendListener”事件中取消发送的电子邮件?

时间:2014-10-22 14:03:20

标签: email symfony events

关注this guide我已经设置了一个事件监听器:

<?php

class EmailListener implements \Swift_Events_SendListener
{
    public $beforeSendEvt = null;
    public $sendEvt = null;

    public function beforeSendPerformed(\Swift_Events_SendEvent $evt)
    {
        $this->beforeSendEvt = $evt;
    }

    public function sendPerformed(\Swift_Events_SendEvent $evt)
    {
        $this->sendEvt = $evt;
    }
}

现在,我想以beforeSendPerformed方式取消此电子邮件。我该怎么做?