Yii::app()->hooks->addFilter('mailer_after_create_message_instance', function($message, $params, $mailer) {
// make sure we get the right mailer and not phpmailer...
if (!($mailer instanceof MailerSwiftMailer) || !($message instanceof Swift_Message)) {
return $message;
}
// remove the header
$message->getHeaders()->remove(sprintf('%sMailer', Yii::app()->params['email.custom.header.prefix']));
// return the message in the end
return $message;
});