protected function getMailer($name, Email $email = null)
    {
        if ($email === null) {
            $email = new Email();
        }

        $className = App::className($name, 'Mailer', 'Mailer');

        if (empty($className)) {
            throw new MissingMailerException(compact('name'));
        }

        return new $className($email);
    }
protected function getMailer($name, Email $email = null)
    {
        if ($email === null) {
            $email = new Email();
        }

        $className = App::className($name, 'Mailer', 'Mailer');

        if (empty($className)) {
            throw new MissingMailerException(compact('name'));
        }

        return new $className($email);
    }
protected function getMailer ( $ name , Email $ email = null ) { if ( $ email === null ) { $ email = new Email ( ) ; } $ className = App :: className ( $ name , 'Mailer' , 'Mailer' ) ; if ( empty ( $ className ) ) { throw new MissingMailerException ( compact ( 'name' ) ) ; } return new $ className ( $ email ) ; }
Returns a mailer instance.

@param string $name Mailer's name.
@param \Cake\Mailer\Email|null $email Email instance.
@return \Cake\Mailer\Mailer
@throws \Cake\Mailer\Exception\MissingMailerException if undefined mailer class.
Returns a mailer instance .