Why can't we log a message here? Also stacktrace should be printed additionally to the message.
Maybe a workaround like this is applicable here: https://github.com/yiisoft/yii2/blob/master/framework/mail/BaseMessage.php#L43 ?