Catch HTML message and possible error message after sending e-mail

Dear,

I am using the default swift mailer and i like to store every send e-mail by the system in a database. I am using the following simple code;

$mailer = Yii::$app->mailer->compose(’@app/views/mail/test, $params);

$mailer->setFrom([Yii::$app->params[‘mail’][‘fromEmail’] => Yii::$app->params[‘mail’][‘fromName’]]);

$mailer->setFrom([‘system@example.com’ => ‘System’]);

$mailer->setTo([‘kevin@example.com’ => ‘Kevin’]);

$mailer->setSubject(‘Test mail’);

// send mail

$sent = $mailer->send();

[list=1]

[*]How can I catch the rendered HTML message, i found the "toString" method, but there the whole raw message will be returned, i only need the HTML code of the message ?

[*]How can I catch an possible error message when sending fails?

[/list]

Thanks.