yii\mail\BaseMailer::afterSend PHP Method

afterSend() public method

You may override this method to do some postprocessing or logging based on mail send status. If you override this method, please make sure you call the parent implementation first.
public afterSend ( yii\mail\MessageInterface $message, boolean $isSuccessful )
$message yii\mail\MessageInterface
$isSuccessful boolean
    public function afterSend($message, $isSuccessful)
    {
        $event = new MailEvent(['message' => $message, 'isSuccessful' => $isSuccessful]);
        $this->trigger(self::EVENT_AFTER_SEND, $event);
    }

Usage Example

Example #1
0
 /**
  * This method is invoked right after mail was send.
  * You may override this method to do some postprocessing or logging based on mail send status.
  * If you override this method, please make sure you call the parent implementation first.
  *
  * Note: as of Yii 2.0.0-beta - hardcoded swiftmailer methods result in UnknownMethodException in debug MailPanel,
  * for patch @see https://github.com/yiisoft/yii2/commit/3838b501babc1f5b9e6b0ba452512fba136d3102
  *
  * @param \yii\mail\MessageInterface $message
  * @param boolean                    $isSuccessful
  */
 public function afterSend($message, $isSuccessful)
 {
     parent::afterSend($message, $isSuccessful);
 }